summaryrefslogtreecommitdiff
path: root/utilities
diff options
context:
space:
mode:
authorSunghyun Kwon <sh0701.kwon@samsung.com>2015-04-14 09:28:24 +0900
committerSunghyun Kwon <sh0701.kwon@samsung.com>2015-04-14 09:28:24 +0900
commit1a7ecbd675279d4953797d973e8eb410eb271b41 (patch)
treeeae65e8547ba3f596cffa39f24778a89fdce69b5 /utilities
parentf388671127415fcd4e495930651b25441d67b4ec (diff)
downloademail-service-1a7ecbd675279d4953797d973e8eb410eb271b41.tar.gz
email-service-1a7ecbd675279d4953797d973e8eb410eb271b41.tar.bz2
email-service-1a7ecbd675279d4953797d973e8eb410eb271b41.zip
Rollback the merged code
Change-Id: Ibe0fb31359149144b68694cba3ae4456cb9a566f
Diffstat (limited to 'utilities')
-rwxr-xr-xutilities/CMakeLists.txt8
-rwxr-xr-xutilities/test-application/include/testapp-gmime.h31
-rwxr-xr-xutilities/test-application/main.c9
-rwxr-xr-xutilities/test-application/testapp-account.c261
-rw-r--r--utilities/test-application/testapp-gmime.c188
-rwxr-xr-xutilities/test-application/testapp-mail.c729
-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
11 files changed, 504 insertions, 1029 deletions
diff --git a/utilities/CMakeLists.txt b/utilities/CMakeLists.txt
index 9009483..3826c96 100755
--- a/utilities/CMakeLists.txt
+++ b/utilities/CMakeLists.txt
@@ -13,7 +13,6 @@ 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")
##########################################################
# Define Test App
@@ -29,7 +28,6 @@ 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(
@@ -42,14 +40,16 @@ INCLUDE_DIRECTORIES(
)
INCLUDE(FindPkgConfig)
-pkg_check_modules(test_app_pkgs REQUIRED glib-2.0 gthread-2.0 vconf uw-imap-toolkit contacts-service2)
+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)
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 -pie")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
ADD_EXECUTABLE(email-test-app ${TEST-APP-SRCS})
TARGET_LINK_LIBRARIES(email-test-app ${test_app_pkgs_LDFLAGS} email-api email-smime-api)
diff --git a/utilities/test-application/include/testapp-gmime.h b/utilities/test-application/include/testapp-gmime.h
deleted file mode 100755
index 0aeafee..0000000
--- a/utilities/test-application/include/testapp-gmime.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-* email-service
-*
-* Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
-*
-* Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-*/
-
-
-
-#ifndef EMAIL_TEST_GMIME_H
-#define EMAIL_TEST_GMIME_H
-
-/* export API */
-void testapp_gmime_main(void);
-
-#endif
-
diff --git a/utilities/test-application/main.c b/utilities/test-application/main.c
index de02f6b..27cbfdd 100755
--- a/utilities/test-application/main.c
+++ b/utilities/test-application/main.c
@@ -44,6 +44,7 @@
#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);
@@ -183,17 +184,19 @@ 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-service is not ready\n");
+ testapp_print ("email-serivce is not ready\n");
exit(0);
}
while (go_to_loop) {
testapp_show_menu (EMAIL_MAIN_MENU);
testapp_show_prompt (EMAIL_MAIN_MENU);
- if (0 >= scanf ("%d", &menu_number))
- testapp_print("Invalid input");
+
+ result_from_scanf = scanf ("%d", &menu_number);
+
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 1cc5d1f..c1b121b 100755
--- a/utilities/test-application/testapp-account.c
+++ b/utilities/test-application/testapp-account.c
@@ -63,6 +63,7 @@ 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");
@@ -82,17 +83,14 @@ gboolean testapp_create_account_object(email_account_t **result_account)
testapp_print("16. mopera\n");
testapp_print("Choose server type: ");
-
- if (0 >= scanf("%d",&account_type))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&account_type);
switch(account_type) {
case 4 :
case 5 :
do {
testapp_print("Enter your account index [1~10] : ");
- if (0 >= scanf("%d",&samsung3g_account_index))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&samsung3g_account_index);
}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);
@@ -100,32 +98,26 @@ gboolean testapp_create_account_object(email_account_t **result_account)
break;
case 14 :
testapp_print("Enter email address : ");
- if (0 >= scanf("%s", address_string))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", address_string);
strcpy(id_string, address_string);
testapp_print("Enter access token : ");
- if (0 >= scanf("%s", accesss_token))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", accesss_token);
testapp_print("Enter refresh token : ");
- if (0 >= scanf("%s", refresh_token))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", refresh_token);
snprintf(password_string, 100, "%s\001%s\001", accesss_token, refresh_token);
break;
default:
testapp_print("Enter email address : ");
- if (0 >= scanf("%s", address_string))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", address_string);
testapp_print("Enter id : ");
- if (0 >= scanf("%s", id_string))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", id_string);
testapp_print("Enter password_string : ");
- if (0 >= scanf("%s", password_string))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", password_string);
break;
}
@@ -152,7 +144,6 @@ 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;
@@ -399,18 +390,19 @@ 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 with_validation = 0; //account_svc_id = 0,
+ 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;
+
- testapp_print("\n>> Enter Account ID: ");
- if (0 >= scanf("%d",&account_id))
- testapp_print("Invalid input. ");
+ testapp_print("\n>> Enter Account No: ");
+ result_from_scanf = scanf("%d",&account_id);
if( (err = email_get_account(account_id, GET_FULL_DATA,&account)) != EMAIL_ERROR_NONE) {
testapp_print ("email_get_account failed - %d\n", err);
@@ -418,56 +410,54 @@ 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):");
- if (0 >= scanf("%d",&(account->check_interval)))
- testapp_print("Invalid input. ");
-/*
+ result_from_scanf = scanf("%d",&(account->check_interval));
+
testapp_print("\n Enter new peak interval (in mins):");
- if (0 >= scanf("%d",&(account->peak_interval));
+ result_from_scanf = scanf("%d",&(account->peak_interval));
testapp_print("\n Enter new peak days:");
- if (0 >= scanf("%d",&(account->peak_days));
+ result_from_scanf = scanf("%d",&(account->peak_days));
testapp_print("\n Enter new peak start time:");
- if (0 >= scanf("%d",&(account->peak_start_time));
+ result_from_scanf = scanf("%d",&(account->peak_start_time));
testapp_print("\n Enter new peak end time:");
- 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);
-
+ result_from_scanf = scanf("%d",&(account->peak_end_time));
+#endif
testapp_print("\n Enter new signature:");
- if (0 >= scanf("%s",signature);
+ result_from_scanf = scanf("%s",signature);
testapp_print("\n>> Enter add_my_address_to_bcc:(0:off, 1:on) ");
- if (0 >= scanf("%d",&add_my_address_to_bcc);
+ result_from_scanf = scanf("%d",&add_my_address_to_bcc);
testapp_print("\n>> Enter account_svc_id: ");
- if (0 >= scanf("%d",&account_svc_id);
+ result_from_scanf = scanf("%d",&account_svc_id);
testapp_print("\n>> With validation ? (0: No, 1:Yes) ");
- if (0 >= scanf("%d",&with_validation);
-*/
+ result_from_scanf = scanf("%d",&with_validation);
+
if( account ) {
- 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);
+ testapp_print("\n Assigning New Account name: (%s)", account->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){
@@ -492,10 +482,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: ");
- if (0 >= scanf("%d",&account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&account_id);
/* sowmya.kr, 281209 Adding signature to options in email_account_t changes */
if( (err = email_get_account(account_id, WITHOUT_OPTION,&account)) < 0) {
@@ -541,17 +531,16 @@ 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: ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &account_id);
testapp_print("\n > Enter handle: ");
- if (0 >= scanf("%d", &account_handle))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &account_handle);
err_code = email_cancel_job(account_id, account_handle, EMAIL_CANCELED_BY_USER);
if(err_code == 0)
@@ -564,12 +553,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: ");
- if (0 >= scanf("%d",&account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&account_id);
typedef struct {
int is_preset_account;
@@ -606,16 +595,11 @@ 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,
@@ -638,13 +622,7 @@ static gboolean testapp_test_get_account()
account->peak_interval,
account->peak_days,
account->peak_start_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
+ account->peak_end_time
);
err_code = email_free_account(&account, 1);
@@ -741,12 +719,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 :");
- if (0 >= scanf("%d",&account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&account_id);
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);
@@ -754,8 +732,7 @@ static gboolean testapp_test_update_check_interval()
}
testapp_print("\n Enter new check interval (in mins):");
- if (0 >= scanf("%d",&(account->check_interval)))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&(account->check_interval));
if((err_code = email_update_account(account_id, account)) != EMAIL_ERROR_NONE) {
testapp_print ("email_update_account failed [%d]\n", err_code);
@@ -773,7 +750,7 @@ FINISH_OFF:
static gboolean testapp_test_backup_account()
{
- char *file_name = "/opt/usr/data/email/accounts_file";
+ char *file_name = "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);
@@ -781,7 +758,7 @@ static gboolean testapp_test_backup_account()
}
static gboolean testapp_test_restore_account()
{
- char *file_name = "/opt/usr/data/email/accounts_file";
+ char *file_name = "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);
@@ -790,56 +767,30 @@ static gboolean testapp_test_restore_account()
static gboolean testapp_test_get_password_length_of_account()
{
- int password_length, account_id;
+ int result_from_scanf = 0;
+ int error_code, password_length, account_id;
testapp_print("\n input account id\n");
- 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);
+ result_from_scanf = scanf("%d", &account_id);
+ error_code = email_get_password_length_of_account(account_id, &password_length);
testapp_print("testapp_test_get_password_length_of_account returned [%d]\n",password_length);
return FALSE;
}
-static gboolean testapp_test_update_notification()
+static gboolean testapp_test_query_server_info()
{
+ int result_from_scanf = 0;
int error_code;
- 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. ");
+ char domain_name[255];
+ email_server_info_t *result_server_info;
- testapp_print("\n Input From eas:\n");
- if (0 >= scanf("%d", &input_from_eas))
- testapp_print("Invalid input. ");
+ testapp_print("\n input domain name\n");
+ result_from_scanf = scanf("%s", domain_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);
+ 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);
return FALSE;
}
@@ -847,20 +798,20 @@ static gboolean testapp_test_clear_all_notification()
{
int error_code;
- error_code = email_clear_notification_bar(ALL_ACCOUNT);
- testapp_print("email_clear_notification_bar returned [%d]\n",error_code);
+ error_code = email_clear_all_notification_bar();
+ testapp_print("email_clear_all_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 : ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &account_id);
error_code = email_save_default_account_id(account_id);
@@ -882,17 +833,16 @@ 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 : ");
- if (0 >= scanf("%s", certificate_path))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", certificate_path);
testapp_print("Input cert email-address : ");
- if (0 >= scanf("%s", save_name))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", save_name);
testapp_print("cert path : [%s]", certificate_path);
testapp_print("email-address : [%s]", save_name);
@@ -909,13 +859,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 : ");
- if (0 >= scanf("%s", save_name))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", save_name);
ret = email_get_certificate(save_name, &certificate);
if (ret != EMAIL_ERROR_NONE) {
@@ -943,12 +893,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 : ");
- if (0 >= scanf("%s", save_name))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", save_name);
ret = email_delete_certificate(save_name);
if (ret != EMAIL_ERROR_NONE) {
@@ -986,13 +936,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: ");
- if (0 >= scanf("%d",&account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&account_id);
if( (err = email_get_account(account_id, GET_FULL_DATA, &account)) != EMAIL_ERROR_NONE) {
testapp_print ("email_get_account failed [%d]\n", err);
@@ -1002,32 +952,27 @@ 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):");
- if (0 >= scanf("%d",&(account->check_interval)))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&(account->check_interval));
testapp_print ("old peak_interval - %d \n", account->peak_interval);
testapp_print("\n Enter new peak interval (in mins):");
- if (0 >= scanf("%d",&(account->peak_interval)))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&(account->peak_interval));
testapp_print ("old peak_days - %d \n", account->peak_days);
testapp_print("\n Enter new peak days:");
- if (0 >= scanf("%d",&(account->peak_days)))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&(account->peak_days));
testapp_print ("old peak_start_time - %d \n", account->peak_start_time);
testapp_print("\n Enter new peak start time:");
- if (0 >= scanf("%d",&(account->peak_start_time)))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&(account->peak_start_time));
testapp_print ("old peak_end_time - %d \n", account->peak_start_time);
testapp_print("\n Enter new peak end time:");
- if (0 >= scanf("%d",&(account->peak_end_time)))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&(account->peak_end_time));
if( account ) {
if((err = email_update_account(account_id, account)) != EMAIL_ERROR_NONE) {
@@ -1088,43 +1033,39 @@ static gboolean testapp_test_interpret_command (int selected_number)
testapp_test_get_password_length_of_account();
break;
- case 13:
- testapp_test_update_notification();
+ case 12:
+ testapp_test_query_server_info();
break;
- case 14:
- testapp_test_clear_notification();
- break;
-
- case 15:
+ case 13:
testapp_test_clear_all_notification();
break;
- case 16:
+ case 14:
testapp_test_save_default_account_id();
break;
- case 17:
+ case 15:
testapp_test_load_default_account_id();
break;
- case 18:
+ case 16:
testapp_test_add_certificate();
break;
- case 19:
+ case 17:
testapp_test_get_certificate();
break;
- case 20:
+ case 18:
testapp_test_delete_certificate();
break;
- case 21:
+ case 19:
testapp_test_add_account();
break;
- case 22:
+ case 20:
testapp_test_update_peak_schedule();
break;
@@ -1143,13 +1084,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);
-
- if (0 >= scanf("%d", &menu_number))
- testapp_print("Invalid input");
+
+ result_from_scanf = scanf ("%d", &menu_number);
go_to_loop = testapp_test_interpret_command (menu_number);
}
diff --git a/utilities/test-application/testapp-gmime.c b/utilities/test-application/testapp-gmime.c
deleted file mode 100644
index 8493160..0000000
--- a/utilities/test-application/testapp-gmime.c
+++ /dev/null
@@ -1,188 +0,0 @@
-#include <glib.h>
-#include <gmime/gmime.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-
-#include "testapp-utility.h"
-#include "testapp-gmime.h"
-
-
-#define TEST_EML_PATH "/tmp/test.eml"
-
-static void print_depth(int depth)
-{
- int i;
- for (i = 0; i < depth; i++)
- testapp_print(" \n");
-}
-
-static void print_mime_struct(GMimeObject *part, int depth)
-{
- const GMimeContentType *type;
- GMimeMultipart *multipart;
- GMimeObject *subpart;
- int i, n;
-
- print_depth(depth);
- type = g_mime_object_get_content_type(part);
- testapp_print("Content-Type: %s/%s\n", type->type, type->subtype);
-
- if (GMIME_IS_MULTIPART(part)) {
- multipart = (GMimeMultipart *)part;
-
- n = g_mime_multipart_get_count(multipart);
- for (i = 0; i < n; i++) {
- subpart = g_mime_multipart_get_part(multipart, i);
- print_mime_struct(subpart, depth + 1);
- g_object_unref(subpart);
- }
- }
-}
-
-static void
-test_eml_parsing_foreach_callback(GMimeObject *parent, GMimeObject *part, gpointer user_data)
-{
- int *cnt= user_data;
-
- (*cnt)++;
-
- if (GMIME_IS_PART(part)) {
- testapp_print ("Part\n");
- GMimePart *leaf_part = NULL;
- leaf_part = (GMimePart *)part;
-
- testapp_print("Content ID:%s\n", g_mime_part_get_content_id(leaf_part));
- testapp_print("Description:%s\n", g_mime_part_get_content_description(leaf_part));
- testapp_print("MD5:%s\n", g_mime_part_get_content_md5(leaf_part));
- testapp_print("Location:%s\n", g_mime_part_get_content_location(leaf_part));
-
- GMimeContentEncoding enc = g_mime_part_get_content_encoding(leaf_part);
- switch(enc) {
- case GMIME_CONTENT_ENCODING_DEFAULT:
- testapp_print("Encoding:ENCODING_DEFAULT\n");
- break;
- case GMIME_CONTENT_ENCODING_7BIT:
- testapp_print("Encoding:ENCODING_7BIT\n");
- break;
- case GMIME_CONTENT_ENCODING_8BIT:
- testapp_print("Encoding:ENCODING_8BIT\n");
- break;
- case GMIME_CONTENT_ENCODING_BINARY:
- testapp_print("Encoding:ENCODING_BINARY\n");
- break;
- case GMIME_CONTENT_ENCODING_BASE64:
- testapp_print("Encoding:ENCODING_BASE64\n");
- break;
- case GMIME_CONTENT_ENCODING_QUOTEDPRINTABLE:
- testapp_print("Encoding:ENCODING_QUOTEDPRINTABLE\n");
- break;
- case GMIME_CONTENT_ENCODING_UUENCODE:
- testapp_print("Encoding:ENCODING_UUENCODE\n");
- break;
-
- default:
- break;
- }
-
- testapp_print("File name:%s\n\n\n", g_mime_part_get_filename(leaf_part));
- GMimeDataWrapper *data = g_mime_part_get_content_object(leaf_part);
-
- if (data) {
- char tmp_path[50] = {0,};
- snprintf(tmp_path, sizeof(tmp_path), "/tmp/gmime_content%d", *cnt);
-
- int fd;
- if ((fd = open(tmp_path, O_RDWR|O_CREAT, 0)) == -1) {
- testapp_print ("open fail\n");
- }
- GMimeStream *out_stream;
- out_stream = g_mime_stream_fs_new(fd);
- g_mime_data_wrapper_write_to_stream(data, out_stream);
- g_object_unref(out_stream);
- }
- }
-}
-
-static gboolean testapp_test_gmime_eml_parsing(void)
-{
- GMimeMessage *message;
- GMimeParser *parser;
- GMimeStream *stream;
- int fd;
- int count = 0;
-
- if ((fd = open(TEST_EML_PATH, O_RDONLY, 0)) == -1) {
- testapp_print ("open fail\n");
- return 0;
- }
-
- /* init the gmime library */
- g_mime_init(0);
-
- /* create a stream to read from the file descriptor */
- stream = g_mime_stream_fs_new(fd);
-
- /* create a new parser object to parse the stream */
- parser = g_mime_parser_new_with_stream(stream);
-
- /* unref the stream (parser owns a ref, so this object does not actually get free'd until we destroy the parser) */
- g_object_unref(stream);
-
- /* parse the message from the stream */
- message = g_mime_parser_construct_message(parser);
-
- /* free the parser (and the stream) */
- g_object_unref(parser);
-
- testapp_print("Sender:%s\n", g_mime_message_get_sender(message));
- testapp_print("Reply To:%s\n", g_mime_message_get_reply_to(message));
- testapp_print("Subject:%s\n", g_mime_message_get_subject(message));
- testapp_print("Date:%s\n", g_mime_message_get_date_as_string(message));
- testapp_print("Message ID:%s\n", g_mime_message_get_message_id(message));
-
- GMimeObject *po = (GMimeObject *)message;
- testapp_print("Header String:%s\n\n\n\n", g_mime_header_list_to_string(po->headers));
-
- g_mime_message_foreach(message, test_eml_parsing_foreach_callback, &count);
-}
-
-static gboolean testapp_test_interpret_command (int menu_number)
-{
- gboolean go_to_loop = TRUE;
-
- switch (menu_number) {
- case 1:
- testapp_test_gmime_eml_parsing();
- break;
-
- case 0:
- go_to_loop = FALSE;
- break;
- default:
- break;
- }
-
- return go_to_loop;
-}
-
-void testapp_gmime_main()
-{
- gboolean go_to_loop = TRUE;
- int menu_number = 0;
-
- while (go_to_loop) {
- testapp_show_menu (EMAIL_GMIME_MENU);
- testapp_show_prompt (EMAIL_GMIME_MENU);
-
- result_from_scanf = scanf ("%d", &menu_number);
-
- 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 00fb137..add534f 100755
--- a/utilities/test-application/testapp-mail.c
+++ b/utilities/test-application/testapp-mail.c
@@ -112,27 +112,24 @@ 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 recipient_address[300] = { 0 , };
+ char receipient_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 : ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &account_id);
- testapp_print("\n > Enter recipient address : ");
- if (0 >= scanf("%s", recipient_address))
- testapp_print("Invalid input. ");
+ testapp_print("\n > Enter receipient address : ");
+ result_from_scanf = scanf("%s", receipient_address);
email_get_account(account_id, GET_FULL_DATA_WITHOUT_PASSWORD, &account_data);
@@ -151,7 +148,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(recipient_address);
+ test_mail_data->full_address_to = strdup(receipient_address);
test_mail_data->subject = strdup("Read receipt request from TIZEN");
test_mail_data->remaining_resend_times = 3;
test_mail_data->report_status = EMAIL_MAIL_REQUEST_DSN | EMAIL_MAIL_REQUEST_MDN;
@@ -171,18 +168,10 @@ 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, 4: pgp sign, 5: pgp encrypted, 6: pgp sign + encrypt] : ");
- if (0 >= scanf("%d", &smime_type))
- testapp_print("Invalid input. ");
+ testapp_print(" > Select smime? [0: Normal, 1: sign, 2: Encrpyt, 3: sing + encrypt] : ");
+ result_from_scanf = scanf("%d", &smime_type);
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
@@ -202,6 +191,7 @@ 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;
@@ -218,13 +208,12 @@ static gboolean testapp_test_add_mail (int *result_mail_id)
FILE *body_file;
testapp_print("\n > Enter account id : ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &account_id);
+
memset(arg, 0x00, 50);
testapp_print("\n > Enter mailbox id : ");
- if (0 >= scanf("%d", &mailbox_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mailbox_id);
email_get_mailbox_by_mailbox_id(mailbox_id, &mailbox_data);
@@ -232,8 +221,7 @@ 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]> ");
- if (0 >= scanf("%d", &from_eas))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &from_eas);
test_mail_data->account_id = account_id;
test_mail_data->save_status = 1;
@@ -268,13 +256,11 @@ 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] : ");
- if (0 >= scanf("%d", &smime_type))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &smime_type);
test_mail_data->smime_type = smime_type;
testapp_print(" > How many file attachment? [>=0] : ");
- if (0 >= scanf("%d",&attachment_count))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&attachment_count);
test_mail_data->attachment_count = attachment_count;
if ( attachment_count > 0 )
@@ -284,15 +270,13 @@ 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 : ");
- if (0 >= scanf("%s", arg))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", arg);
attachment_data[i].attachment_name = strdup(arg);
memset(arg, 0x00, 50);
testapp_print("\n > Enter attachment absolute path : ");
- if (0 >= scanf("%s",arg))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s",arg);
attachment_data[i].attachment_path = strdup(arg);
attachment_data[i].save_status = 1;
@@ -300,8 +284,7 @@ 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)]");
- if (0 >= scanf("%d", (int*)&(test_mail_data->meeting_request_status)))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", (int*)&(test_mail_data->meeting_request_status));
if ( test_mail_data->meeting_request_status == 1
|| test_mail_data->meeting_request_status == 2 ) {
@@ -353,6 +336,7 @@ 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;
@@ -363,8 +347,7 @@ static gboolean testapp_test_update_mail()
email_meeting_request_t *meeting_req = NULL;
testapp_print("\n > Enter mail id : ");
- if (0 >= scanf("%d", &mail_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mail_id);
email_get_mail_data(mail_id, &test_mail_data);
@@ -374,8 +357,7 @@ static gboolean testapp_test_update_mail()
}
testapp_print("\n > Enter Subject: ");
- if (0 >= scanf("%s", arg))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", arg);
test_mail_data->subject= strdup(arg);
@@ -396,8 +378,7 @@ static gboolean testapp_test_update_mail()
}
testapp_print("\n > Enter meeting response: ");
- if (0 >= scanf("%d", (int*)&(meeting_req->meeting_response)))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", (int*)&(meeting_req->meeting_response));
}
if ( (err = email_update_mail(test_mail_data, test_attachment_data_list, test_attachment_data_count, meeting_req, 0)) != EMAIL_ERROR_NONE)
@@ -438,34 +419,29 @@ 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) : ");
- if (0 >= scanf("%d",&account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&account_id);
+
testapp_print("\n > Enter Mailbox id (0 = all mailboxes) :");
- if (0 >= scanf("%d", &mailbox_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mailbox_id);
testapp_print("\n > Enter Sorting : ");
- if (0 >= scanf("%d",&sorting))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&sorting);
testapp_print("\n > Enter Start index (starting at 0): ");
- if (0 >= scanf("%d",&start_index))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&start_index);
testapp_print("\n > Enter max_count : ");
- if (0 >= scanf("%d",&limit_count))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&limit_count);
testapp_print("\n > For thread view : ");
- if (0 >= scanf("%d",&is_for_thread_view))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&is_for_thread_view);
testapp_print("\n > Mail count only (0:list 1:count): ");
- if (0 >= scanf("%d",&to_get_count))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&to_get_count);
if(to_get_count)
mails_pointer = NULL;
@@ -573,7 +549,6 @@ 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;
@@ -674,17 +649,10 @@ 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;
@@ -715,10 +683,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: ");
- if (0 >= scanf("%d", &num))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &num);
mailIdList = (int *)malloc(sizeof(int)*num);
if(!mailIdList)
return false ;
@@ -733,12 +701,10 @@ static gboolean testapp_test_send_cancel ()
mail_id = 0;
testapp_print("\n > Do you want to cancel the send mail job '1' or '0': ");
- if (0 >= scanf("%d", &Y))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &Y);
if(Y == 1) {
testapp_print("\n >Enter mail-id[1-%d] ",i);
- if (0 >= scanf("%d", &j))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &j);
testapp_print("\n mailIdList[%d] ",mailIdList[j]);
if(email_cancel_sending_mail( mailIdList[j]) < 0)
testapp_print("email_cancel_sending_mail failed..!");
@@ -755,22 +721,19 @@ 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: ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &account_id);
testapp_print("\n > Enter Mail_id: ");
- if (0 >= scanf("%d", &mail_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mail_id);
testapp_print("\n > Enter Mailbox id: ");
- if (0 >= scanf("%d", &mailbox_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mailbox_id);
testapp_print("\n > Enter from_server: ");
- if (0 >= scanf("%d", &from_server))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &from_server);
/* delete message */
if( (err = email_delete_mail(mailbox_id, &mail_id, 1, from_server)) < 0)
@@ -788,24 +751,21 @@ 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: ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &account_id);
testapp_print("\n > Enter attribute_type: ");
- if (0 >= scanf("%d", (int*)&attribute_type))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", (int*)&attribute_type);
testapp_print("\n > Enter integer type value: ");
- if (0 >= scanf("%d", (int*)&(attribute_value.integer_type_value)))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", (int*)&(attribute_value.integer_type_value));
testapp_print("\n > Enter mail_id_count: ");
- if (0 >= scanf("%d", &mail_id_count))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mail_id_count);
mail_id_count = (mail_id_count < 5000)?mail_id_count:5000;
@@ -815,8 +775,7 @@ static gboolean testapp_test_update_mail_attribute()
for (i = 0; i < mail_id_count; i++) {
testapp_print("\n > Enter mail id: ");
- if (0 >= scanf("%d", (mail_id_array + i)))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", (mail_id_array + i));
}
/* delete message */
@@ -836,16 +795,15 @@ 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: ");
- if (0 >= scanf("%d",&mail_id[i]))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&mail_id[i]);
}
testapp_print("\n > Enter mailbox_id: ");
- if (0 >= scanf("%d", &mailbox_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mailbox_id);
/* move mail */
email_move_mail_to_mailbox(mail_id, 3, mailbox_id);
@@ -856,10 +814,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: ");
- if (0 >= scanf("%d",&mailbox_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&mailbox_id);
/* delete all message */
if ( (err = email_delete_all_mails_in_mailbox(mailbox_id, 0)) < 0)
@@ -874,25 +832,23 @@ 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: ");
- if (0 >= scanf("%d", &mail_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mail_id);
memset(&attachment, 0x00, sizeof(email_attachment_data_t));
memset(arg, 0x00, 100);
testapp_print("\n > Enter attachment name: ");
- if (0 >= scanf("%s",arg))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s",arg);
attachment.attachment_name = strdup(arg);
memset(arg, 0x00, 100);
testapp_print("\n > Enter attachment absolute path: ");
- if (0 >= scanf("%s",arg))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s",arg);
attachment.save_status = true;
attachment.attachment_path = strdup(arg);
@@ -913,15 +869,14 @@ 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: ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &account_id);
do {
testapp_print("\n >>> Input target mail id ( Input 0 to terminate ) [MAX = 100]: ");
- if (0 >= scanf("%d", &temp_mail_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &temp_mail_id);
mail_ids[index++] = temp_mail_id;
} while (temp_mail_id != 0);
@@ -937,14 +892,13 @@ 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: ");
- if (0 >= scanf("%d", &mailbox_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mailbox_id);
testapp_print("\n >>> Expunge on server?: ");
- if (0 >= scanf("%d", &on_server))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &on_server);
err_code = email_expunge_mails_deleted_flagged(mailbox_id, on_server, &handle);
@@ -958,11 +912,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: ");
- if (0 >= scanf("%d", &read_mail_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &read_mail_id);
err_code = email_add_read_receipt(read_mail_id, &receipt_mail_id);
@@ -983,10 +937,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: ");
- if (0 >= scanf("%d", &attachment_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &attachment_id);
if( (err_code = email_delete_attachment(attachment_id)) != EMAIL_ERROR_NONE) {
testapp_print("email_delete_attachment failed[%d]\n", err_code);
@@ -1010,34 +964,28 @@ 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) : ");
- if (0 >= scanf("%d",&account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&account_id);
testapp_print("\n > Enter Mailbox id (0 = all mailboxes) :");
- if (0 >= scanf("%d", &mailbox_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mailbox_id);
testapp_print("\n > Enter Sorting : ");
- if (0 >= scanf("%d",&sorting))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&sorting);
testapp_print("\n > Enter Start index (starting at 0): ");
- if (0 >= scanf("%d",&start_index))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&start_index);
testapp_print("\n > Enter max_count : ");
- if (0 >= scanf("%d",&limit_count))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&limit_count);
testapp_print("\n > For thread view : ");
- if (0 >= scanf("%d",&is_for_thread_view))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&is_for_thread_view);
testapp_print("\n > Count mails?(1: YES):");
- if (0 >= scanf("%d",&to_get_count))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&to_get_count);
if(to_get_count)
mail_list_pointer = NULL;
@@ -1112,16 +1060,15 @@ 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");
- if (0 >= scanf("%d",&account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&account_id);
testapp_print("\nEnter mailbox id\n");
- if (0 >= scanf("%d",&mailbox_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&mailbox_id);
/* Get mail list */
@@ -1195,18 +1142,16 @@ 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: ");
- if (0 >= scanf("%d", &source_mailbox_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &source_mailbox_id);
testapp_print("\n > Enter target mailbox id: ");
- if (0 >= scanf("%d", &target_mailbox_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &target_mailbox_id);
testapp_print("\n > Enter mail count: ");
- if (0 >= scanf("%d", &mail_id_count))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mail_id_count);
mail_id_count = (mail_id_count < 5000)?mail_id_count:5000;
@@ -1216,8 +1161,7 @@ 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: ");
- if (0 >= scanf("%d", (mail_id_array + i)))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", (mail_id_array + i));
}
err = email_move_mails_to_mailbox_of_another_account(source_mailbox_id, mail_id_array, mail_id_count, target_mailbox_id, &task_id);
@@ -1230,6 +1174,7 @@ 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;
}
@@ -1251,7 +1196,7 @@ static gboolean copy_file(char *input_source_path, char *input_dest_path)
if( WIFEXITED(childExitStatus)) /* exit code in childExitStatus */
{
- WEXITSTATUS(childExitStatus); /* zero is normal exit */
+ status = WEXITSTATUS(childExitStatus); /* zero is normal exit */
testapp_print("WEXITSTATUS\n");
/* handle non-zero as you wish */
}
@@ -1273,6 +1218,7 @@ 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;
@@ -1285,8 +1231,7 @@ 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: ");
- if (0 >= scanf("%d", &original_mail_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &original_mail_id);
/* Get original mail */
if((err = email_get_mail_data(original_mail_id, &original_mail_data)) != EMAIL_ERROR_NONE || !original_mail_data) {
@@ -1398,11 +1343,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: ");
- if (0 >= scanf("%d", &mail_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mail_id);
/* Get original mail */
if((err = email_get_mail_data(mail_id, &mail_data)) != EMAIL_ERROR_NONE || !mail_data) {
@@ -1531,14 +1476,13 @@ 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: ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &account_id);
testapp_print("\n > Enter Mail ID: ");
- if (0 >= scanf("%d", &mail_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mail_id);
if(email_set_flags_field(account_id, &mail_id, 1, EMAIL_FLAGS_FLAGGED_FIELD, 1, 1) < 0)
testapp_print("email_set_flags_field failed");
@@ -1552,10 +1496,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: ");
- if (0 >= scanf("%d", &mail_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mail_id);
err = email_download_body(mail_id, 0, &handle);
if(err < 0)
testapp_print("email_download_body failed");
@@ -1573,25 +1517,23 @@ 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: ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &account_id);
testapp_print("\n > Enter mail id: ");
- if (0 >= scanf("%d", &mail_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mail_id);
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");
- if (0 >= scanf("%d",&yes))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&yes);
if(1 == yes) {
if(email_cancel_job(account_id, handle , EMAIL_CANCELED_BY_USER) < 0)
testapp_print("email_cancel_job failed..!");
@@ -1609,14 +1551,13 @@ 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: ");
- if (0 >= scanf("%d", &mail_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mail_id);
testapp_print("\n > Enter attachment number: ");
- if (0 >= scanf("%d", &attachment_no))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &attachment_no);
if( email_download_attachment(mail_id, attachment_no ,&handle) < 0)
testapp_print("email_download_attachment failed");
@@ -1633,12 +1574,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: ");
- if (0 >= scanf("%d", &mail_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mail_id);
if ( (err = email_get_attachment_data_list(mail_id, &test_attachment_data_list, &test_attachment_data_count)) != EMAIL_ERROR_NONE ) {
testapp_print("email_get_attachment_data_list() failed [%d]\n", err);
@@ -1664,12 +1605,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: ");
- if (0 >= scanf("%d", &mail_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mail_id);
err = email_get_meeting_request(mail_id, &meeting_request);
@@ -1689,17 +1630,16 @@ 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: ");
- if (0 >= scanf("%d", &mail_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mail_id);
testapp_print("\n > Enter timeout in seconds: ");
- if (0 >= scanf("%d", &timeout))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &timeout);
if( email_retry_sending_mail(mail_id, timeout) < 0)
testapp_print("email_retry_sending_mail failed");
@@ -1709,11 +1649,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: ");
- if (0 >= scanf("%d", &attachment_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &attachment_id);
email_get_attachment_data(attachment_id, &attachment);
@@ -1731,16 +1671,15 @@ 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> ");
- if (0 >= scanf("%d", &src_mailbox_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &src_mailbox_id);
testapp_print("dest mailbox id> ");
- if (0 >= scanf("%d", &dest_mailbox_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &dest_mailbox_id);
err = email_move_all_mails_to_mailbox(src_mailbox_id, dest_mailbox_id);
if ( err < 0 ) {
@@ -1772,37 +1711,33 @@ 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;
char *cc = NULL;
char *bcc = NULL;
- to = (char *) malloc(500000);
- cc = (char *) malloc(500000);
+ to = (char *) malloc(500000);
+ cc = (char *) malloc(500000);
bcc = (char *) malloc(500000);
- memset(to, 0x00, sizeof(500000));
- memset(cc, 0x00, sizeof(500000));
- memset(bcc, 0x00, sizeof(500000));
+ memset(to, 0x00, sizeof(to));
+ memset(cc, 0x00, sizeof(to));
+ memset(bcc, 0x00, sizeof(to));
testapp_print("Input Mail id:\n");
- if (0 >= scanf("%d", &mail_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mail_id);
testapp_print("Input Account id:\n");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &account_id);
testapp_print("Input TO field:\n");
- if (0 >= scanf("%s", to))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", to);
testapp_print("Input CC field:\n");
- if (0 >= scanf("%s", cc))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", cc);
testapp_print("Input BCC field:\n");
- if (0 >= scanf("%s", bcc))
- testapp_print("Invalid input. ");
-
- if ( emstorage_test(NULL, mail_id, account_id, to, cc, bcc, &err) == true ) {
+ result_from_scanf = scanf("%s", bcc);
+
+ if ( emstorage_test(mail_id, account_id, to, cc, bcc, &err) == true ) {
testapp_print(">> Saving Succeeded\n");
}
else {
@@ -1876,7 +1811,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");
- if (0 >= scanf("%d", &type);
+ result_from_scanf = scanf("%d", &type);
switch ( type ) {
case 1:
@@ -1886,12 +1821,12 @@ static gboolean testapp_test_address_format_check_test()
address_count++;
}
testapp_print("Choose address to be tested:[99:quit]\n");
- if (0 >= scanf("%d", &index);
+ result_from_scanf = scanf("%d", &index);
if ( index == 99 )
break;
testapp_print(">> [%d] Checking? (1:Yes, Other:No) [%s]\n", index, address_list[index]);
- if (0 >= scanf("%d", &check_yn);
+ result_from_scanf = scanf("%d", &check_yn);
if ( check_yn == 1 ) {
pAddress = strdup(address_list[index]);
if ( em_verify_email_address(pAddress, false, &err ) == true ) {
@@ -1913,7 +1848,7 @@ static gboolean testapp_test_address_format_check_test()
break;
case 2:
testapp_print("Input address: \n");
- if (0 >= scanf("%s", input_address);
+ result_from_scanf = scanf("%s", input_address);
if ( em_verify_email_address(input_address, false, &err ) == true ) {
testapp_print(">> Saving Succeeded : addr[%s]\n", input_address);
}
@@ -1935,9 +1870,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][%d]\n\n", max_count, err);
+ testapp_print("\n\t>>>>> email_get_max_mail_count() return [%d]\n\n", max_count);
- return TRUE;
+ return false;
}
#include "email-storage.h"
@@ -1965,6 +1900,7 @@ 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;
@@ -1972,8 +1908,7 @@ static gboolean testapp_test_get_address_info_list()
memset(buf, 0x00, sizeof(buf));
testapp_print("\n > Enter mail_id: ");
- if (0 >= scanf("%d",&mail_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&mail_id);
email_get_address_info_list(mail_id, &address_info_list);
@@ -2018,6 +1953,102 @@ static gboolean testapp_test_get_address_info_list()
return TRUE;
}
+static gboolean testapp_test_search_mail_on_server()
+{
+ testapp_print(" >>> testapp_test_search_mail_on_server : Entered \n");
+
+ int err_code = EMAIL_ERROR_NONE;
+ int account_id = 0;
+ int mailbox_id = 0;
+ int search_key_value_integer = 0;
+ int result_from_scanf = 0;
+ email_search_filter_type search_filter_type = 0;
+ email_search_filter_t search_filter;
+ 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);
+
+ 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;
+
+ 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_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;
+ break;
+ default :
+ testapp_print("Invalid filter type [%d]", search_filter_type);
+ return FALSE;
+ }
+
+ if( (err_code = email_search_mail_on_server(account_id, mailbox_id, &search_filter,1, &handle)) != EMAIL_ERROR_NONE) {
+ testapp_print("email_search_mail_on_server failed [%d]", err_code);
+ }
+
+ testapp_print(" >>> testapp_test_search_mail_on_server : END \n");
+ return TRUE;
+}
+
static gboolean testapp_test_add_mail_to_search_result_box()
{
int i = 0;
@@ -2025,6 +2056,7 @@ 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;
@@ -2034,8 +2066,7 @@ static gboolean testapp_test_add_mail_to_search_result_box()
FILE *body_file = NULL;
testapp_print("\n > Enter account id : ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &account_id);
email_get_mailbox_by_mailbox_type(account_id, EMAIL_MAILBOX_TYPE_SEARCH_RESULT, &mailbox_data);
@@ -2043,8 +2074,7 @@ 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]> ");
- if (0 >= scanf("%d", &from_eas))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &from_eas);
test_mail_data->account_id = account_id;
test_mail_data->save_status = 1;
@@ -2068,14 +2098,12 @@ static gboolean testapp_test_add_mail_to_search_result_box()
fclose(body_file);
testapp_print(" > Attach file? [0/1] : ");
- if (0 >= scanf("%d",&attachment_count))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d",&attachment_count);
if ( attachment_count ) {
memset(arg, 0x00, 50);
testapp_print("\n > Enter attachment name : ");
- if (0 >= scanf("%s", arg))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", arg);
attachment_data = malloc(sizeof(email_attachment_data_t));
@@ -2083,8 +2111,7 @@ static gboolean testapp_test_add_mail_to_search_result_box()
memset(arg, 0x00, 50);
testapp_print("\n > Enter attachment absolute path : ");
- if (0 >= scanf("%s",arg))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s",arg);
attachment_data->attachment_path = strdup(arg);
attachment_data->save_status = 1;
@@ -2092,8 +2119,7 @@ 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)]");
- if (0 >= scanf("%d", (int*)&(test_mail_data->meeting_request_status)))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", (int*)&(test_mail_data->meeting_request_status));
if ( test_mail_data->meeting_request_status == 1
|| test_mail_data->meeting_request_status == 2 ) {
@@ -2143,24 +2169,21 @@ 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 : ");
- if (0 >= scanf("%s", eml_file_path))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", eml_file_path);
- 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;
}
@@ -2181,7 +2204,6 @@ 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);
@@ -2189,35 +2211,27 @@ 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_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)) != EMAIL_ERROR_NONE)
- testapp_print("email_get_decrypt_message_ex failed\n");
- }
-
+ if (mail_data->smime_type == EMAIL_SMIME_SIGNED) {
+ if (!email_verify_signature_ex(mail_data, mail_attachment_data, attachment_count, &verify)) {
+ testapp_print("email_verify_signature_ex failed\n");
+ }
+
testapp_print("verify : [%d]\n", verify);
}
+
if ((err = email_delete_parsed_data(mail_data)) != EMAIL_ERROR_NONE) {
testapp_print("email_delete_eml_data failed : [%d]\n", err);
@@ -2244,18 +2258,27 @@ 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);
- 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 : ");
- if (0 >= scanf("%d", &mail_id))
- testapp_print("Invalid input. ");
+ ret_scanf = scanf("%d", &mail_id);
+
err = email_get_mail_data(mail_id, &mail_data);
if (err != EMAIL_ERROR_NONE || mail_data == NULL) {
@@ -2269,7 +2292,10 @@ static gboolean testapp_test_email_write_mime_file()
return false;
}
- snprintf(file_path, 512, "/opt/usr/data/email/.email_data/tmp/%d_%8d.eml", mail_id, (int)time(NULL));
+ testapp_print("Input Account id : ");
+ ret_scanf = scanf("%d", &account_id);
+
+ mail_data->account_id = account_id;
err = email_write_mime_file(mail_data, mail_attachment_data, attachment_count, &file_path);
if (err != EMAIL_ERROR_NONE) {
@@ -2294,12 +2320,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 :");
- if (0 >= scanf("%d", &mail_id))
- testapp_print("Invalid input. ");
+ ret_scanf = scanf("%d", &mail_id);
err = email_verify_signature(mail_id, &verify);
if (err != EMAIL_ERROR_NONE) {
@@ -2311,208 +2337,6 @@ 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)
{
@@ -2630,23 +2454,20 @@ static gboolean testapp_test_interpret_command (int menu_number)
case 57:
testapp_test_update_mail();
break;
+ case 58:
+ testapp_test_search_mail_on_server();
+ break;
case 59:
testapp_test_add_mail_to_search_result_box();
break;
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 63:
- testapp_test_email_add_mail_with_multiple_recipient();
- break;
- case 64:
- testapp_test_send_mails_every_x_minutes();
+ case 61:
+ testapp_test_email_write_mime_file();
break;
case 0:
go_to_loop = FALSE;
@@ -2662,13 +2483,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);
- if (0 >= scanf("%d", &menu_number))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", &menu_number);
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 5540da4..6caee04 100755
--- a/utilities/test-application/testapp-mailbox.c
+++ b/utilities/test-application/testapp-mailbox.c
@@ -79,34 +79,30 @@ 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: ");
- if (0 >= scanf("%s",arg))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s",arg);
mailbox.mailbox_name = strdup(arg);
memset(arg, 0x00, 500);
testapp_print("> Enter mailbox alias name: ");
- if (0 >= scanf("%s",arg))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s",arg);
mailbox.alias = strdup(arg);
testapp_print("> Enter account id: ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &account_id);
mailbox.account_id = account_id;
testapp_print("> Enter local_yn (1/0): ");
- if (0 >= scanf("%d", &local_yn))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &local_yn);
mailbox.local= local_yn;
testapp_print("> Enter mailbox type: ");
- if (0 >= scanf("%d", &mailbox_type))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mailbox_type);
mailbox.mailbox_type= mailbox_type;
mailbox.eas_data = strdup("EAS DATA TEST");
@@ -134,14 +130,13 @@ 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:");
- if (0 >= scanf("%d", &mailbox_id))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", &mailbox_id);
testapp_print("> Enter on_server (1/0): ");
- if (0 >= scanf("%d", &on_server))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", &on_server);
ret = email_delete_mailbox(mailbox_id, on_server, &handle);
@@ -163,19 +158,17 @@ 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: ");
- if (0 >= scanf("%d", &mailbox_id))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", &mailbox_id);
testapp_print("> Enter new mailbox name: ");
- if (0 >= scanf("%s", mailbox_name))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%s", mailbox_name);
testapp_print("> Enter new mailbox name: ");
- if (0 >= scanf("%s", mailbox_alias))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%s", mailbox_alias);
if ( (err = email_rename_mailbox(mailbox_id, mailbox_name, mailbox_alias, true, &handle)) < 0) {
@@ -192,10 +185,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: ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", &account_id);
if( email_sync_imap_mailbox_list(account_id, &handle) < 0)
testapp_print("email_sync_imap_mailbox_list failed");
@@ -208,14 +201,13 @@ 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: ");
- if (0 >= scanf("%d", &mailbox_id))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", &mailbox_id);
testapp_print("> Enter local: ");
- if (0 >= scanf("%d", &is_local_mailbox))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", &is_local_mailbox);
if( email_set_local_mailbox(mailbox_id, is_local_mailbox) < 0)
testapp_print("email_set_local_mailbox failed");
@@ -232,18 +224,16 @@ 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: ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", &account_id);
testapp_print("\n > Enter mailbox_id_count: ");
- if (0 >= scanf("%d", &mailbox_id_count))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", &mailbox_id_count);
testapp_print("\n > Enter on_server: ");
- if (0 >= scanf("%d", &on_server))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", &on_server);
mailbox_id_count = (mailbox_id_count < 5000)?mailbox_id_count:5000;
@@ -253,8 +243,7 @@ static gboolean testapp_test_delete_mailbox_ex()
for(i = 0; i < mailbox_id_count; i++) {
testapp_print("\n > Enter mailbox id: ");
- if (0 >= scanf("%d", (mailbox_id_array + i)))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", (mailbox_id_array + i));
}
err = email_delete_mailbox_ex(account_id, mailbox_id_array, mailbox_id_count, on_server, &handle);
@@ -271,16 +260,15 @@ 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: ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", &account_id);
testapp_print("\n > Enter mailbox_type: ");
- if (0 >= scanf("%d", (int*)&mailbox_type))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", (int*)&mailbox_type);
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);
@@ -298,14 +286,13 @@ 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 : ");
- if (0 >= scanf("%d", &mailbox_id))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", &mailbox_id);
testapp_print("\n > Enter mailbox type : ");
- if (0 >= scanf("%d", &mailbox_type))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", &mailbox_type);
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);
@@ -320,18 +307,16 @@ 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): ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", &account_id);
testapp_print("\n> Enter mailbox id (0 : All mailboxes):");
- if (0 >= scanf("%d", &mailbox_id))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", &mailbox_id);
testapp_print("\n > Enter mailbox slot size: ");
- if (0 >= scanf("%d", &mail_slot_size))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", &mail_slot_size);
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);
@@ -343,17 +328,16 @@ 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: ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", &account_id);
testapp_print("\n > Enter mailbox_sync_type\n[-1 :for all mailboxes, 0 : for mailboxes from server, 1 : local mailboxes\n : ");
- if (0 >= scanf("%d", &mailbox_sync_type))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", &mailbox_sync_type);
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);
@@ -377,18 +361,17 @@ 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: ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d", &account_id);
testapp_print("> Enter keyword: ");
- if (0 >= scanf("%s", keyword))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%s", keyword);
if ((error_code = email_get_mailbox_list_by_keyword(account_id, keyword, &mailbox_list, &count)) < 0) {
testapp_print(" email_get_mailbox_list_by_keyword error %d\n", error_code);
@@ -405,17 +388,16 @@ 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) : ");
- if (0 >= scanf("%d",&account_id))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d",&account_id);
testapp_print("\n > Enter Mailbox id (0: for all mailboxes) : ");
- if (0 >= scanf("%d",&mailbox_id))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d",&mailbox_id);
if(account_id == ALL_ACCOUNT) {
if(email_sync_header_for_all_account(&handle) < 0)
@@ -435,11 +417,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 : ");
- if (0 >= scanf("%d",&input_mailbox_id))
- testapp_print("Invalid input");
+ result_from_scanf = scanf("%d",&input_mailbox_id);
email_stamp_sync_time_of_mailbox(input_mailbox_id);
@@ -454,19 +436,18 @@ 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: ");
- if (0 >= scanf("%d", &mailbox_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mailbox_id);
testapp_print("> Enter new mailbox name: ");
- if (0 >= scanf("%s", mailbox_name))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", mailbox_name);
testapp_print("> Enter new mailbox alias: ");
- if (0 >= scanf("%s", mailbox_alias))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", mailbox_alias);
+
if ( (err = email_rename_mailbox_ex(mailbox_id, mailbox_name, mailbox_alias, eas_data, strlen(eas_data), false, &handle)) < 0) {
testapp_print("\n email_rename_mailbox failed[%d]\n", err);
@@ -552,13 +533,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);
- if (0 >= scanf("%d", &menu_number))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &menu_number);
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 51c2af1..e24d32e 100755
--- a/utilities/test-application/testapp-others.c
+++ b/utilities/test-application/testapp-others.c
@@ -54,28 +54,19 @@ 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): ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &account_id);
testapp_print("\n > Enter handle: ");
- if (0 >= scanf("%d", &handle))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &handle);
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");
@@ -92,14 +83,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 : ");
- if (0 >= scanf("%s", html_file_path))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", html_file_path);
- emcore_get_preview_text_from_file(NULL, NULL, html_file_path, 1024, &preview_buffer);
+ emcore_get_preview_text_from_file(NULL, html_file_path, 1024, &preview_buffer);
testapp_print("\n result :\n %s ", preview_buffer);
@@ -370,10 +361,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 : ");
- if (0 >= scanf("%d", &mail_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &mail_id);
email_show_user_message(mail_id, EMAIL_ACTION_SEND_MAIL, EMAIL_ERROR_NETWORK_NOT_AVAILABLE);
return FALSE;
@@ -382,11 +373,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 : ");
- if (0 >= scanf("%s", mime_path))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s", mime_path);
email_get_mime_entity(mime_path, &mime_entity);
@@ -396,32 +387,15 @@ 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 : ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &account_id);
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;
@@ -430,9 +404,6 @@ 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;
@@ -468,9 +439,6 @@ 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;
@@ -485,13 +453,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);
- if (0 >= scanf ("%d", &menu_number))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf ("%d", &menu_number);
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 e963b2e..9cb6519 100755
--- a/utilities/test-application/testapp-rule.c
+++ b/utilities/test-application/testapp-rule.c
@@ -45,44 +45,38 @@ 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: ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &account_id);
rule->account_id = account_id;
testapp_print("> Enter Type(FROM - 1 / SUBJECT - 2): ");
- if (0 >= scanf("%d", &type))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &type);
rule->type= type;
memset(arg, 0x00, 500);
testapp_print("\n> Enter Filtering Value:");
- if (0 >= scanf("%s",arg))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s",arg);
rule->value= strdup(arg);
testapp_print("> Enter Action(MOVE - 1, BLOCK - 2, DELETE - 3): ");
- if (0 >= scanf("%d", &action))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &action);
rule->faction= action;
if (action == 1) {
testapp_print("\n> Enter target mailbox id:");
- if (0 >= scanf("%d", &target_mailbox_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &target_mailbox_id);
rule->target_mailbox_id = target_mailbox_id;
}
- testapp_print("> Enter Flag1 value [On/Off]: ");
- if (0 >= scanf("%d", &flag))
- testapp_print("Invalid input. ");
+ testapp_print("> Enter Flag1 value: ");
+ result_from_scanf = scanf("%d", &flag);
rule->flag1= flag;
- testapp_print("> Enter Flag2 value [0:Exactly same as, 1:Include, 2:Compare Domain] : ");
- if (0 >= scanf("%d", &flag))
- testapp_print("Invalid input. ");
+ testapp_print("> Enter Flag2 value: ");
+ result_from_scanf = scanf("%d", &flag);
rule->flag2= flag;
if (email_add_rule(rule) < 0)
@@ -100,11 +94,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: ");
- if (0 >= scanf("%d", &filter_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &filter_id);
if(email_delete_rule(filter_id) < 0)
testapp_print("email_delete_rule failed..! ");
@@ -115,6 +109,7 @@ 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;
@@ -127,45 +122,37 @@ static gboolean testapp_test_update_rule()
rule = malloc(sizeof(email_rule_t));
memset(rule,0X00,sizeof(email_rule_t));
testapp_print("> Enter filter id: ");
- if (0 >= scanf("%d", &filter_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &filter_id);
testapp_print("> Enter account id: ");
- if (0 >= scanf("%d", &account_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &account_id);
rule->account_id = account_id;
testapp_print("> Enter Type(FROM - 1 / SUBJECT - 2): ");
- if (0 >= scanf("%d", &type))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &type);
rule->type= type;
memset(arg, 0x00, 500);
testapp_print("\n> Enter Filtering Value:");
- if (0 >= scanf("%s",arg))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%s",arg);
rule->value= strdup(arg);
testapp_print("> Enter Action(MOVE - 1, BLOCK - 2, DELETE - 3): ");
- if (0 >= scanf("%d", &action))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &action);
rule->faction= action;
if (action == 1) {
testapp_print("\n> Enter target mailbox id:");
- if (0 >= scanf("%d", &target_mailbox_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &target_mailbox_id);
rule->target_mailbox_id = target_mailbox_id;
}
testapp_print("> Enter Flag1 value: ");
- if (0 >= scanf("%d", &flag))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &flag);
rule->flag1= flag;
testapp_print("> Enter Flag2 value: ");
- if (0 >= scanf("%d", &flag))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &flag);
rule->flag2= flag;
if( !email_update_rule(filter_id, rule) < 0)
@@ -181,10 +168,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: ");
- if (0 >= scanf("%d", &filter_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &filter_id);
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);
@@ -255,13 +242,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);
- if (0 >= scanf("%d", &menu_number))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &menu_number);
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 cfad6e2..34b913e 100755
--- a/utilities/test-application/testapp-thread.c
+++ b/utilities/test-application/testapp-thread.c
@@ -41,20 +41,19 @@ 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: ");
- if (0 >= scanf("%d", &thread_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &thread_id);
testapp_print("\n > Enter target_mailbox_id: ");
- if (0 >= scanf("%d", &target_mailbox_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &target_mailbox_id);
testapp_print("\n > Enter move_always_flag: ");
- if (0 >= scanf("%d", &move_always_flag))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &move_always_flag);
- email_move_thread_to_mailbox(thread_id, target_mailbox_id, move_always_flag);
+ result = email_move_thread_to_mailbox(thread_id, target_mailbox_id, move_always_flag);
return FALSE;
}
@@ -62,16 +61,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: ");
- if (0 >= scanf("%d", &thread_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &thread_id);
testapp_print("\n > Enter delete_always_flag: ");
- if (0 >= scanf("%d", &delete_always_flag))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &delete_always_flag);
- email_delete_thread(thread_id, delete_always_flag);
+ result = email_delete_thread(thread_id, delete_always_flag);
return FALSE;
}
@@ -79,20 +78,19 @@ 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: ");
- if (0 >= scanf("%d", &thread_id))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &thread_id);
testapp_print("\n > Enter seen_flag: ");
- if (0 >= scanf("%d", &seen_flag))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &seen_flag);
testapp_print("\n > Enter on_server: ");
- if (0 >= scanf("%d", &on_server))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &on_server);
- email_modify_seen_flag_of_thread(thread_id, seen_flag, on_server);
+ result = email_modify_seen_flag_of_thread(thread_id, seen_flag, on_server);
return FALSE;
}
@@ -128,13 +126,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);
- if (0 >= scanf("%d", &menu_number))
- testapp_print("Invalid input. ");
+ result_from_scanf = scanf("%d", &menu_number);
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 910b85a..c834b7e 100755
--- a/utilities/test-application/testapp-utility.c
+++ b/utilities/test-application/testapp-utility.c
@@ -76,16 +76,15 @@ 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 (" 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 (" 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 (" 0. Go to Main Menu\n");
testapp_print ("------------------------------------------\n");
break;
@@ -135,8 +134,6 @@ 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;
@@ -192,7 +189,6 @@ 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");
@@ -204,7 +200,6 @@ 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;