list_data *ld = eina_list_data_get(nth_list);
/* save the mail-id to be moved */
- if (mailbox_ugd->previous_view == EMAIL_VIEW_UNREAD ||
- mailbox_ugd->previous_view == EMAIL_VIEW_IMPORTANT ||
- mailbox_ugd->previous_view == EMAIL_VIEW_ATTACHMENTS ||
- mailbox_ugd->previous_view == EMAIL_VIEW_PRIORITY ||
- mailbox_ugd->previous_view == EMAIL_VIEW_RECIPIENT ||
- mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX ||
- mailbox_ugd->b_thread_list == false)
- {
- debug_log("not Thread... previous_view[%d]", mailbox_ugd->previous_view);
- int mail_id = ld->mail_id;
- mailbox_ugd->selected_list =
- g_list_prepend(mailbox_ugd->selected_list, GINT_TO_POINTER(mail_id));
- }
- /* get mails of thread id and add them to selected_list */
- else {
- /* Get thread mail list */
- email_mail_list_item_t *mailbox_data = NULL;
- int mail_count = 0;
- int err = email_get_mail_list(ld->account_id, 0, ld->thread_id,
- -1, /* start_index */
- -1, /* limit_count */
- _mailbox_conv_sort_type(mailbox_ugd->sort_type), &mailbox_data, &mail_count);
- if( err != EMAIL_ERROR_NONE ) {
- debug_warning("email_get_mail_list_ex - err(%d)", err);
- }
- int k = 0;
- for( ; k<mail_count ; k++ )
- mailbox_ugd->selected_list = g_list_prepend(mailbox_ugd->selected_list,
- GINT_TO_POINTER(mailbox_data[k].mail_id));
- FREE(mailbox_data);
- }
-
+ debug_log("not Thread... previous_view[%d]", mailbox_ugd->previous_view);
+ int mail_id = ld->mail_id;
+ mailbox_ugd->selected_list = g_list_prepend(mailbox_ugd->selected_list, GINT_TO_POINTER(mail_id));
}
int i = 0;
int max_account_id = email_engine_get_max_account_id();
int result = EMAIL_ERROR_UNKNOWN;
+ int is_trash = false;
if (max_account_id < 0) {
- debug_error("Invalid max_account_id was returned.");
+ debug_error("Invalid max_account_id(%d) was returned.", max_account_id);
return;
}
- GList *move_mail_list[max_account_id];
- memset(move_mail_list, 0, max_account_id*sizeof(GList *));
-
- /* delete list and count */
- GList *del_mail_list = NULL;
+ GList *mail_list[max_account_id];
+ memset(mail_list, 0, max_account_id*sizeof(GList *));
Eina_List *list = edit_list;
int checked_count = eina_list_count(list);
debug_log("checked_count: %d", checked_count);
if (checked_count <= 0) return;
- /* if single mail view (not threaded view), */
- if (previous_view == EMAIL_VIEW_UNREAD ||
- previous_view == EMAIL_VIEW_IMPORTANT ||
- previous_view == EMAIL_VIEW_PRIORITY ||
- previous_view == EMAIL_VIEW_ATTACHMENTS ||
- previous_view == EMAIL_VIEW_RECIPIENT ||
- mailbox_ugd->mode == EMAIL_MAILBOX_MODE_MAILBOX ||
- mailbox_ugd->b_thread_list == false)
- {
- /* get the first item and check if item is in trash box. if so, all other items are in trash */
- list_data* ld = eina_list_data_get(list);
- int is_trash = (GET_MAILBOX_TYPE(ld->mailbox_id) == EMAIL_MAILBOX_TYPE_TRASH)? 1:0;
-
- Eina_List* cur = NULL;
- EINA_LIST_FOREACH(list, cur, ld)
- {
- if ( is_trash )
- del_mail_list =
- g_list_prepend(del_mail_list, GINT_TO_POINTER(ld->mail_id));
- else
- move_mail_list[ld->account_id-1] =
- g_list_prepend(move_mail_list[ld->account_id-1], GINT_TO_POINTER(ld->mail_id));
- }
- }
- /* if threaded mail view */
- else if (previous_view == EMAIL_VIEW_DATE)
- {
- /* Get thread mail list */
- Eina_List* cur = NULL;
- list_data* ld = NULL;
- EINA_LIST_FOREACH(list, cur, ld)
- {
-
- int count = 0;
- int acct = ld->account_id;
- if( acct <= 0 ) {
- debug_log("acct(%d) should be positive", acct);
- }
- email_mail_list_item_t *mail_list = NULL;
- int e = email_get_mail_list(acct, 0, ld->thread_id, -1, -1,
- _mailbox_conv_sort_type(mailbox_ugd->sort_type), &mail_list, &count);
- debug_log("id %d, count %d", acct, count);
- if( e != EMAIL_ERROR_NONE || !mail_list ) {
- debug_warning("email_get_mail_list -err(%d), acct(%d), th_id(%d), sort(%d) or mail_list NULL(%p)",
- e, acct, NULL, ld->thread_id, mailbox_ugd->sort_type, mail_list);
- continue;
- }
- int i=0;
- for( ; i < count ; i++ )
- move_mail_list[acct-1] =
- g_list_prepend(move_mail_list[acct-1], GINT_TO_POINTER(mail_list[i].mail_id));
-
- FREE(mail_list);
- }
- }
-
+ /* get the first item and check if item is in trash box. if so, all other items are in trash */
+ list_data* ld = eina_list_data_get(list);
+ is_trash = (GET_MAILBOX_TYPE(ld->mailbox_id) == EMAIL_MAILBOX_TYPE_TRASH)? 1:0;
- /* delete routine */
- if ( del_mail_list )
+ Eina_List* cur = NULL;
+ EINA_LIST_FOREACH(list, cur, ld)
{
- int count = g_list_length(del_mail_list);
- int mail_ids[count]; memset(mail_ids, 0, sizeof(mail_ids));
- int i=0;
- GList* cur = g_list_first(del_mail_list);
- for ( ; i < count; ++i, cur = g_list_next(cur)) {
- mail_ids[i] = (int) g_list_nth_data(cur, 0);
- }
-
- result = email_delete_mail(mailbox_ugd->mailbox_id, mail_ids, count, EMAIL_DELETE_LOCAL_AND_SERVER);
-
- if (result != EMAIL_ERROR_NONE) {
- debug_warning("email_delete_message account_id(%d) count(%d)- err (%d)",
- mailbox_ugd->account_id, count, result);
- }
+ mail_list[ld->account_id-1] = g_list_prepend(mail_list[ld->account_id-1], GINT_TO_POINTER(ld->mail_id));
}
- /* move-mails-to-trash routine */
+ /* move or delete mails rutine.*/
int acct = 0;
for ( acct = 0; acct < max_account_id; ++acct) {
- if ( !move_mail_list[acct]) continue;
- else
- {
+ if ( !mail_list[acct]) continue;
+ else {
/* convert GList to int array */
- int count = g_list_length(move_mail_list[acct]);
+ int count = g_list_length(mail_list[acct]);
int mail_ids[count]; memset(mail_ids, 0, sizeof(mail_ids));
int i=0;
- GList* cur = g_list_first(move_mail_list[acct]);
+ GList* cur = g_list_first(mail_list[acct]);
for( ; i < count ; i++, cur=g_list_next(cur))
mail_ids[i] = (int) g_list_nth_data(cur, 0);
- /* making dest folder - trash */
- int trashbox_id = GET_MAILBOX_ID(acct+1, EMAIL_MAILBOX_TYPE_TRASH);
+ debug_log("account_id : %d, count : %d", acct+1, count);
+
+ if (is_trash) {
+ email_delete_option_t delete_option = EMAIL_DELETE_LOCAL_AND_SERVER;
+
+ if (GET_ACCOUNT_SERVER_TYPE(acct+1) == EMAIL_SERVER_TYPE_POP3) {
+ debug_log("EMAIL_SERVER_TYPE_POP3..");
+ email_account_t *account_data = NULL;
+ if (email_engine_get_account_full_data(acct+1, &account_data)) {
+ if (account_data) {
+ account_user_data_t *user_data = (account_user_data_t*)account_data->user_data;
+ if (user_data != NULL) {
+ debug_log("pop3_deleting_option:%d", user_data->pop3_deleting_option);
+ if (user_data->pop3_deleting_option == 0) {
+ delete_option = EMAIL_DELETE_LOCALLY;
+ } else if (user_data->pop3_deleting_option == 1) {
+ delete_option = EMAIL_DELETE_LOCAL_AND_SERVER;
+ }
+ }
+ email_free_account(&account_data, 1);
+ account_data = NULL;
+ }
+ }
+ }
+
+ int trashbox_id = GET_MAILBOX_ID(acct+1, EMAIL_MAILBOX_TYPE_TRASH);
+
+ result = email_delete_mail(trashbox_id, mail_ids, count, delete_option);
+ if (result != EMAIL_ERROR_NONE) {
+ debug_warning("email_delete_message mailbox_id(%d) count(%d)- err (%d)",
+ mailbox_ugd->mailbox_id, count, result);
+ }
+ } else {
+ /* making dest folder - trash */
+ int trashbox_id = GET_MAILBOX_ID(acct+1, EMAIL_MAILBOX_TYPE_TRASH);
- result = email_move_mail_to_mailbox(mail_ids, count, trashbox_id);
- if (result != EMAIL_ERROR_NONE) {
- debug_warning("email_move_mail_to_mailbox acct(%d) folder_id(%d) num(%d) - err (%d)",
- acct+1, trashbox_id, count, result);
+ result = email_move_mail_to_mailbox(mail_ids, count, trashbox_id);
+ if (result != EMAIL_ERROR_NONE) {
+ debug_warning("email_move_mail_to_mailbox num(%d) folder_id(%d) - err (%d)",
+ count, trashbox_id, result);
+ }
}
}
}
}
}
-//CLEANUP:
-
- if (del_mail_list) {
- g_list_free(del_mail_list);
- }
-
for (i = 0; i < max_account_id; ++i) {
- if (move_mail_list[i] != NULL) {
- g_list_free(move_mail_list[i]);
- move_mail_list[i] = NULL;
+ if (mail_list[i] != NULL) {
+ g_list_free(mail_list[i]);
+ mail_list[i] = NULL;
}
}
return;
}
list_data *ld = (list_data *)data;
-// EmailMailboxUGD *mailbox_ugd = (EmailMailboxUGD *)(ld->mailbox_ugd);
debug_log("mailbox_ugd->account_id: %d", ld->account_id);
debug_log("ld->mail_id: %d", ld->mail_id);
- email_mailbox_t *mbox = NULL;
- int e = email_get_mailbox_by_mailbox_id(ld->mailbox_id, &mbox);
- if (e != EMAIL_ERROR_NONE) {
- debug_log("email_get_mailbox_by_mailbox_id mailbox_id(%d)- err[%d]", ld->mailbox_id, e);
- goto CLEANUP;
- }
-
if (ld->mailbox_ugd->ug_composer) {
debug_log("Composer UG is already launched");
- goto CLEANUP;
+ return;
}
service_h service;
if (SERVICE_ERROR_NONE != service_create(&service))
{
debug_log("creating service handle failed");
- goto CLEANUP;
+ return;
}
char cmd[30] = { 0, };
ld->mailbox_ugd->ug_composer = create_composer_ug(UG_NAME_EMAIL_COMPOSER, service, ld->mailbox_ugd);
service_destroy(service);
-CLEANUP:
- email_free_mailbox(&mbox, 1);
-
}
static void _sweep_forward_cb(void *data, Evas_Object *obj, void *event_info)
debug_log("mailbox_ugd->account_id: %d", ld->account_id);
debug_log("ld->mail_id: %d", ld->mail_id);
- email_mailbox_t *mbox = NULL;
- int e = email_get_mailbox_by_mailbox_id(ld->mailbox_id, &mbox);
- if (e != EMAIL_ERROR_NONE) {
- debug_log("email_get_mailbox_by_mailbox_id mailbox_id(%d)- err[%d]", ld->mailbox_id, e);
- goto CLEANUP;
- }
-
if (ld->mailbox_ugd->ug_composer) {
debug_log("Composer UG is already launched");
- goto CLEANUP;
+ return;
}
service_h service;
if (SERVICE_ERROR_NONE != service_create(&service))
{
debug_log("creating service handle failed");
- goto CLEANUP;
+ return;
}
char cmd[30] = { 0, };
ld->mailbox_ugd->ug_composer = create_composer_ug(UG_NAME_EMAIL_COMPOSER, service, ld->mailbox_ugd);
service_destroy(service);
-CLEANUP:
- email_free_mailbox(&mbox, 1);
-
}
static void _sweep_mark_as_read_unread_cb(void *data, Evas_Object *obj, void *event_info)