2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999-2001 Hiroyuki Yamamoto
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 #include <gtk/gtkmain.h>
28 #include <gtk/gtkwindow.h>
29 #include <gtk/gtksignal.h>
33 #include <sys/types.h>
42 #include "mainwindow.h"
43 #include "folderview.h"
44 #include "summaryview.h"
45 #include "prefs_common.h"
46 #include "prefs_account.h"
55 #include "statusbar.h"
56 #include "manage_window.h"
57 #include "progressdialog.h"
58 #include "inputdialog.h"
59 #include "alertpanel.h"
61 #include "automaton.h"
64 #include "pixmaps/continue.xpm"
65 #include "pixmaps/complete.xpm"
66 #include "pixmaps/error.xpm"
68 GdkPixmap *currentxpm;
69 GdkBitmap *currentxpmmask;
71 GdkBitmap *errorxpmmask;
75 #define MSGBUFSIZE 8192
77 static void inc_finished (MainWindow *mainwin);
78 static void inc_account_mail (PrefsAccount *account,
81 static IncProgressDialog *inc_progress_dialog_create (void);
82 static void inc_progress_dialog_destroy (IncProgressDialog *inc_dialog);
84 static IncSession *inc_session_new (PrefsAccount *account);
85 static void inc_session_destroy (IncSession *session);
86 static Pop3State *inc_pop3_state_new (PrefsAccount *account);
87 static void inc_pop3_state_destroy (Pop3State *state);
88 static void inc_start (IncProgressDialog *inc_dialog);
89 static IncState inc_pop3_session_do (IncSession *session);
90 static gint pop3_automaton_terminate (SockInfo *source,
93 static GHashTable *inc_get_uidl_table (PrefsAccount *ac_prefs);
94 static void inc_write_uidl_list (Pop3State *state);
97 static gint connection_check_cb (Automaton *atm);
100 static void inc_pop3_recv_func (SockInfo *sock,
104 static void inc_put_error (IncState istate);
106 static void inc_cancel (GtkWidget *widget,
109 static gint inc_spool (void);
110 static gint get_spool (FolderItem *dest,
113 static void inc_all_spool(void);
115 static void inc_finished(MainWindow *mainwin)
119 if (prefs_common.open_inbox_on_inc) {
120 item = cur_account && cur_account->inbox
121 ? folder_find_item_from_path(cur_account->inbox)
122 : folder_get_default_inbox();
123 folderview_unselect(mainwin->folderview);
124 folderview_select(mainwin->folderview, item);
126 item = mainwin->summaryview->folder_item;
127 folderview_unselect(mainwin->folderview);
128 folderview_select(mainwin->folderview, item);
132 void inc_mail(MainWindow *mainwin)
134 summary_write_cache(mainwin->summaryview);
136 if (prefs_common.use_extinc && prefs_common.extinc_path) {
139 /* external incorporating program */
140 if ((pid = fork()) < 0) {
146 execlp(prefs_common.extinc_path,
147 g_basename(prefs_common.extinc_path),
150 /* this will be called when failed */
155 /* wait until child process is terminated */
156 waitpid(pid, NULL, 0);
158 if (prefs_common.inc_local) inc_spool();
161 if (prefs_common.inc_local) inc_spool();
164 inc_account_mail(cur_account, mainwin);
167 inc_finished(mainwin);
170 static void inc_account_mail(PrefsAccount *account, MainWindow *mainwin)
172 IncProgressDialog *inc_dialog;
176 session = inc_session_new(account);
177 if (!session) return;
179 inc_dialog = inc_progress_dialog_create();
180 inc_dialog->queue_list = g_list_append(inc_dialog->queue_list, session);
181 inc_dialog->mainwin = mainwin;
182 session->data = inc_dialog;
185 text[1] = account->account_name;
186 text[2] = _("Standby");
187 gtk_clist_append(GTK_CLIST(inc_dialog->dialog->clist), text);
189 inc_start(inc_dialog);
192 void inc_all_account_mail(MainWindow *mainwin)
194 GList *list, *queue_list = NULL;
195 IncProgressDialog *inc_dialog;
197 summary_write_cache(mainwin->summaryview);
199 if (prefs_common.inc_local) inc_spool();
201 list = account_get_list();
204 for (; list != NULL; list = list->next) {
206 PrefsAccount *account = list->data;
208 if (account->recv_at_getall) {
209 session = inc_session_new(account);
211 queue_list = g_list_append(queue_list, session);
215 if (!queue_list) return;
217 inc_dialog = inc_progress_dialog_create();
218 inc_dialog->queue_list = queue_list;
219 inc_dialog->mainwin = mainwin;
220 for (list = queue_list; list != NULL; list = list->next) {
221 IncSession *session = list->data;
224 session->data = inc_dialog;
227 text[1] = session->pop3_state->ac_prefs->account_name;
228 text[2] = _("Standby");
229 gtk_clist_append(GTK_CLIST(inc_dialog->dialog->clist), text);
232 inc_start(inc_dialog);
234 inc_finished(mainwin);
237 static IncProgressDialog *inc_progress_dialog_create(void)
239 IncProgressDialog *dialog;
240 ProgressDialog *progress;
242 dialog = g_new0(IncProgressDialog, 1);
244 progress = progress_dialog_create();
245 gtk_window_set_title(GTK_WINDOW(progress->window),
246 _("Retrieving new messages"));
247 gtk_signal_connect(GTK_OBJECT(progress->cancel_btn), "clicked",
248 GTK_SIGNAL_FUNC(inc_cancel), dialog);
249 gtk_signal_connect(GTK_OBJECT(progress->window), "delete_event",
250 GTK_SIGNAL_FUNC(gtk_true), NULL);
251 manage_window_set_transient(GTK_WINDOW(progress->window));
253 progress_dialog_set_value(progress, 0.0);
255 gtk_widget_show(progress->window);
257 PIXMAP_CREATE(progress->clist, okxpm, okxpmmask, complete_xpm);
258 PIXMAP_CREATE(progress->clist,
259 currentxpm, currentxpmmask, continue_xpm);
260 PIXMAP_CREATE(progress->clist, errorxpm, errorxpmmask, error_xpm);
262 gtk_widget_show_now(progress->window);
264 dialog->dialog = progress;
265 dialog->queue_list = NULL;
270 static void inc_progress_dialog_clear(IncProgressDialog *inc_dialog)
272 progress_dialog_set_value(inc_dialog->dialog, 0.0);
273 progress_dialog_set_label(inc_dialog->dialog, "");
276 static void inc_progress_dialog_destroy(IncProgressDialog *inc_dialog)
278 g_return_if_fail(inc_dialog != NULL);
280 progress_dialog_destroy(inc_dialog->dialog);
285 static IncSession *inc_session_new(PrefsAccount *account)
289 g_return_val_if_fail(account != NULL, NULL);
291 if (account->protocol != A_POP3 && account->protocol != A_APOP)
293 if (!account->recv_server || !account->userid)
296 session = g_new0(IncSession, 1);
297 session->pop3_state = inc_pop3_state_new(account);
298 session->pop3_state->session = session;
303 static void inc_session_destroy(IncSession *session)
305 g_return_if_fail(session != NULL);
307 inc_pop3_state_destroy(session->pop3_state);
311 static Pop3State *inc_pop3_state_new(PrefsAccount *account)
315 state = g_new0(Pop3State, 1);
317 state->ac_prefs = account;
318 state->folder_table = g_hash_table_new(NULL, NULL);
319 state->id_table = inc_get_uidl_table(account);
320 state->id_list = NULL;
321 state->new_id_list = NULL;
322 state->inc_state = INC_SUCCESS;
327 static void inc_pop3_state_destroy(Pop3State *state)
329 g_hash_table_destroy(state->folder_table);
330 g_free(state->sizes);
332 if (state->id_table) {
333 hash_free_strings(state->id_table);
334 g_hash_table_destroy(state->id_table);
336 slist_free_strings(state->id_list);
337 slist_free_strings(state->new_id_list);
338 g_slist_free(state->id_list);
339 g_slist_free(state->new_id_list);
341 g_free(state->greeting);
344 g_free(state->prev_folder);
349 static void inc_start(IncProgressDialog *inc_dialog)
352 GtkCList *clist = GTK_CLIST(inc_dialog->dialog->clist);
353 Pop3State *pop3_state;
357 while (inc_dialog->queue_list != NULL) {
358 session = inc_dialog->queue_list->data;
359 pop3_state = session->pop3_state;
361 inc_progress_dialog_clear(inc_dialog);
363 pop3_state->user = g_strdup(pop3_state->ac_prefs->userid);
364 if (pop3_state->ac_prefs->passwd)
366 g_strdup(pop3_state->ac_prefs->passwd);
367 else if (pop3_state->ac_prefs->tmp_pass)
369 g_strdup(pop3_state->ac_prefs->tmp_pass);
374 message = g_strdup_printf
375 (_("Input password for %s on %s:"),
377 pop3_state->ac_prefs->recv_server);
379 pass = input_dialog_with_invisible(_("Input password"),
382 manage_window_focus_in(inc_dialog->mainwin->window,
385 pop3_state->ac_prefs->tmp_pass = g_strdup(pass);
386 pop3_state->pass = pass;
388 inc_session_destroy(session);
389 inc_dialog->queue_list = g_list_remove
390 (inc_dialog->queue_list, session);
395 gtk_clist_set_pixmap(clist, num, 0, currentxpm, currentxpmmask);
396 gtk_clist_set_text(clist, num, 2, _("Retrieving"));
398 /* begin POP3 session */
399 inc_state = inc_pop3_session_do(session);
401 if (inc_state == INC_SUCCESS || inc_state == INC_CANCEL) {
402 gtk_clist_set_pixmap(clist, num, 0, okxpm, okxpmmask);
403 gtk_clist_set_text(clist, num, 2, _("Done"));
405 gtk_clist_set_pixmap(clist, num, 0, errorxpm, errorxpmmask);
406 gtk_clist_set_text(clist, num, 2, _("Error"));
409 if (pop3_state->error_val == PS_AUTHFAIL) {
410 manage_window_focus_in(inc_dialog->dialog->window, NULL, NULL);
412 (_("Authorization for %s on %s failed"),
414 pop3_state->ac_prefs->recv_server);
418 manage_window_focus_in(inc_dialog->mainwin->window, NULL, NULL);
420 folder_item_scan_foreach(pop3_state->folder_table);
421 folderview_update_item_foreach(pop3_state->folder_table);
423 if (pop3_state->error_val == PS_AUTHFAIL &&
424 pop3_state->ac_prefs->tmp_pass) {
425 g_free(pop3_state->ac_prefs->tmp_pass);
426 pop3_state->ac_prefs->tmp_pass = NULL;
429 inc_write_uidl_list(pop3_state);
431 if (inc_state != INC_SUCCESS) {
432 inc_put_error(inc_state);
436 inc_session_destroy(session);
437 inc_dialog->queue_list =
438 g_list_remove(inc_dialog->queue_list, session);
443 while (inc_dialog->queue_list != NULL) {
444 session = inc_dialog->queue_list->data;
445 inc_session_destroy(session);
446 inc_dialog->queue_list =
447 g_list_remove(inc_dialog->queue_list, session);
450 inc_progress_dialog_destroy(inc_dialog);
454 static IncState inc_pop3_session_do(IncSession *session)
456 Pop3State *pop3_state = session->pop3_state;
457 IncProgressDialog *inc_dialog = (IncProgressDialog *)session->data;
464 static AtmHandler handlers[] = {
466 pop3_getauth_user_send , pop3_getauth_user_recv,
467 pop3_getauth_pass_send , pop3_getauth_pass_recv,
468 pop3_getauth_apop_send , pop3_getauth_apop_recv,
469 pop3_getrange_stat_send , pop3_getrange_stat_recv,
470 pop3_getrange_last_send , pop3_getrange_last_recv,
471 pop3_getrange_uidl_send , pop3_getrange_uidl_recv,
472 pop3_getsize_list_send , pop3_getsize_list_recv,
473 pop3_retr_send , pop3_retr_recv,
474 pop3_delete_send , pop3_delete_recv,
475 pop3_logout_send , pop3_logout_recv
478 debug_print(_("getting new messages of account %s...\n"),
479 pop3_state->ac_prefs->account_name);
481 atm = automaton_create(N_POP3_PHASE);
484 atm->data = pop3_state;
486 buf = g_strdup_printf(_("%s: Retrieving new messages"),
487 pop3_state->ac_prefs->recv_server);
488 gtk_window_set_title(GTK_WINDOW(inc_dialog->dialog->window), buf);
491 for (i = POP3_GREETING_RECV; i < N_POP3_PHASE; i++)
492 atm->state[i].handler = handlers[i];
493 atm->state[POP3_GREETING_RECV].condition = GDK_INPUT_READ;
494 for (i = POP3_GETAUTH_USER_SEND; i < N_POP3_PHASE; ) {
495 atm->state[i++].condition = GDK_INPUT_WRITE;
496 atm->state[i++].condition = GDK_INPUT_READ;
499 atm->terminate = (AtmHandler)pop3_automaton_terminate;
501 atm->num = POP3_GREETING_RECV;
503 server = pop3_state->ac_prefs->recv_server;
504 port = pop3_state->ac_prefs->set_popport ?
505 pop3_state->ac_prefs->popport : 110;
507 buf = g_strdup_printf(_("Connecting to POP3 server: %s ..."), server);
508 log_message("%s\n", buf);
509 progress_dialog_set_label(inc_dialog->dialog, buf);
514 if ((sockinfo = sock_connect_with_thread(server, port)) == NULL) {
516 if ((sockinfo = sock_connect(server, port)) == NULL) {
518 log_warning(_("Can't connect to POP3 server: %s:%d\n"),
520 manage_window_focus_in(inc_dialog->dialog->window, NULL, NULL);
521 alertpanel_error(_("Can't connect to POP3 server: %s:%d"),
523 manage_window_focus_out(inc_dialog->dialog->window, NULL, NULL);
524 pop3_automaton_terminate(NULL, atm);
525 automaton_destroy(atm);
530 /* :WK: Hmmm, with the later sock_gdk_input, we have 2 references
531 * to the sock structure - implement a reference counter?? */
532 pop3_state->sockinfo = sockinfo;
533 atm->help_sock = sockinfo;
535 recv_set_ui_func(inc_pop3_recv_func, session);
538 atm->timeout_tag = gtk_timeout_add
539 (TIMEOUT_ITV, (GtkFunction)connection_check_cb, atm);
541 atm->tag = sock_gdk_input_add(sockinfo,
542 atm->state[atm->num].condition,
543 automaton_input_cb, atm);
548 recv_set_ui_func(NULL, NULL);
551 //pthread_join(sockinfo->connect_thr, NULL);
553 automaton_destroy(atm);
555 return pop3_state->inc_state;
558 static gint pop3_automaton_terminate(SockInfo *source, Automaton *atm)
561 gdk_input_remove(atm->tag);
564 if (atm->timeout_tag > 0) {
565 gtk_timeout_remove(atm->timeout_tag);
566 atm->timeout_tag = 0;
573 atm->terminated = TRUE;
578 static GHashTable *inc_get_uidl_table(PrefsAccount *ac_prefs)
583 gchar buf[IDLEN + 3];
585 path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
586 "uidl-", ac_prefs->recv_server,
587 "-", ac_prefs->userid, NULL);
588 if ((fp = fopen(path, "r")) == NULL) {
589 if (ENOENT != errno) FILE_OP_ERROR(path, "fopen");
595 table = g_hash_table_new(g_str_hash, g_str_equal);
597 while (fgets(buf, sizeof(buf), fp) != NULL) {
599 g_hash_table_insert(table, g_strdup(buf), GINT_TO_POINTER(1));
607 static void inc_write_uidl_list(Pop3State *state)
613 if (!state->id_list) return;
615 path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
616 "uidl-", state->ac_prefs->recv_server,
617 "-", state->user, NULL);
618 if ((fp = fopen(path, "w")) == NULL) {
619 FILE_OP_ERROR(path, "fopen");
624 for (cur = state->id_list; cur != NULL; cur = cur->next) {
625 if (fputs((gchar *)cur->data, fp) == EOF) {
626 FILE_OP_ERROR(path, "fputs");
629 if (fputc('\n', fp) == EOF) {
630 FILE_OP_ERROR(path, "fputc");
635 if (fclose(fp) == EOF) FILE_OP_ERROR(path, "fclose");
640 static gint connection_check_cb(Automaton *atm)
642 Pop3State *state = atm->data;
643 IncProgressDialog *inc_dialog = state->session->data;
644 SockInfo *sockinfo = state->sockinfo;
646 //g_print("connection check\n");
648 if (sockinfo->state == CONN_LOOKUPFAILED ||
649 sockinfo->state == CONN_FAILED) {
650 atm->timeout_tag = 0;
651 pop3_automaton_terminate(sockinfo->sock, atm);
652 log_warning(_("Can't connect to POP3 server: %s:%d\n"),
653 sockinfo->hostname, sockinfo->port);
654 manage_window_focus_in(inc_dialog->dialog->window, NULL, NULL);
655 alertpanel_error(_("Can't connect to POP3 server: %s:%d"),
656 sockinfo->hostname, sockinfo->port);
657 manage_window_focus_out(inc_dialog->dialog->window, NULL, NULL);
659 } else if (sockinfo->state == CONN_ESTABLISHED) {
660 atm->timeout_tag = 0;
661 atm->tag = gdk_input_add(sockinfo->sock,
662 atm->state[atm->num].condition,
663 automaton_input_cb, atm);
671 static void inc_pop3_recv_func(SockInfo *sock, gint read_len, gpointer data)
673 gchar buf[MSGBUFSIZE];
674 IncSession *session = (IncSession *)data;
675 Pop3State *state = session->pop3_state;
676 IncProgressDialog *inc_dialog = session->data;
677 ProgressDialog *dialog = inc_dialog->dialog;
680 state->cur_msg_bytes += read_len;
681 cur_total = state->cur_total_bytes + state->cur_msg_bytes;
682 if (cur_total > state->total_bytes)
683 cur_total = state->total_bytes;
685 g_snprintf(buf, sizeof(buf),
686 _("Retrieving message (%d / %d) (%d / %d bytes)"),
687 state->cur_msg, state->count,
688 cur_total, state->total_bytes);
689 progress_dialog_set_label(dialog, buf);
691 progress_dialog_set_percentage
692 (dialog, (gfloat)cur_total / (gfloat)state->total_bytes);
696 void inc_progress_update(Pop3State *state, Pop3Phase phase)
698 gchar buf[MSGBUFSIZE];
699 IncProgressDialog *inc_dialog = state->session->data;
700 ProgressDialog *dialog = inc_dialog->dialog;
703 case POP3_GREETING_RECV:
705 case POP3_GETAUTH_USER_SEND:
706 case POP3_GETAUTH_USER_RECV:
707 case POP3_GETAUTH_PASS_SEND:
708 case POP3_GETAUTH_PASS_RECV:
709 case POP3_GETAUTH_APOP_SEND:
710 case POP3_GETAUTH_APOP_RECV:
711 progress_dialog_set_label(dialog, _("Authorizing"));
713 case POP3_GETRANGE_STAT_SEND:
714 case POP3_GETRANGE_STAT_RECV:
715 case POP3_GETRANGE_LAST_SEND:
716 case POP3_GETRANGE_LAST_RECV:
717 case POP3_GETRANGE_UIDL_SEND:
718 case POP3_GETRANGE_UIDL_RECV:
719 progress_dialog_set_label(dialog,
720 _("Getting number of new messages"));
724 g_snprintf(buf, sizeof(buf),
725 _("Retrieving message (%d / %d) (%d / %d bytes)"),
726 state->cur_msg, state->count,
727 state->cur_total_bytes, state->total_bytes);
728 progress_dialog_set_label(dialog, buf);
729 progress_dialog_set_percentage
731 (gfloat)(state->cur_total_bytes) /
732 (gfloat)(state->total_bytes));
734 case POP3_DELETE_SEND:
735 case POP3_DELETE_RECV:
736 progress_dialog_set_label(dialog, _("Deleting message"));
738 case POP3_LOGOUT_SEND:
739 case POP3_LOGOUT_RECV:
740 progress_dialog_set_label(dialog, _("Quitting"));
746 gint inc_drop_message(const gchar *file, Pop3State *state)
749 FolderItem *dropfolder;
752 if (state->ac_prefs->inbox) {
753 inbox = folder_find_item_from_path(state->ac_prefs->inbox);
755 inbox = folder_get_default_inbox();
757 inbox = folder_get_default_inbox();
763 if (state->ac_prefs->filter_on_recv) {
765 filter_get_dest_folder(prefs_common.fltlist, file);
766 if (!dropfolder) dropfolder = inbox;
767 else if (!strcmp(dropfolder->path, FILTER_NOT_RECEIVE)) {
768 g_warning(_("a message won't be received\n"));
774 val = GPOINTER_TO_INT(g_hash_table_lookup
775 (state->folder_table, dropfolder));
777 folder_item_scan(dropfolder);
778 g_hash_table_insert(state->folder_table, dropfolder,
782 if (folder_item_add_msg(dropfolder, file) < 0) {
791 static void inc_put_error(IncState istate)
795 alertpanel_error(_("Error occurred while processing mail."));
798 alertpanel_error(_("No disk space left."));
804 static void inc_cancel(GtkWidget *widget, gpointer data)
806 IncProgressDialog *dialog = data;
807 IncSession *session = dialog->queue_list->data;
808 SockInfo *sockinfo = session->pop3_state->sockinfo;
811 if (sockinfo->state == CONN_READY ||
812 sockinfo->state == CONN_LOOKUPSUCCESS) {
813 pthread_cancel(sockinfo->connect_thr);
814 //pthread_kill(sockinfo->connect_thr, SIGINT);
815 g_print("connection was cancelled.\n");
819 session->pop3_state->inc_state = INC_CANCEL;
820 pop3_automaton_terminate(sockinfo, session->atm);
823 static gint inc_spool(void)
825 gchar *mbox, *logname;
828 logname = g_get_user_name();
829 mbox = g_strconcat(prefs_common.spool_path
830 ? prefs_common.spool_path : DEFAULT_SPOOL_PATH,
831 G_DIR_SEPARATOR_S, logname, NULL);
832 msgs = get_spool(folder_get_default_inbox(), mbox);
838 static void inc_spool_account(PrefsAccount *account)
841 FolderItem *dropfolder;
844 if (account->inbox) {
845 inbox = folder_find_item_from_path(account->inbox);
847 inbox = folder_get_default_inbox();
849 inbox = folder_get_default_inbox();
851 get_spool(inbox, account->local_mbox);
854 static void inc_all_spool(void)
858 list = account_get_list();
861 for (; list != NULL; list = list->next) {
863 PrefsAccount *account = list->data;
865 if (account->protocol == A_LOCAL)
866 inc_spool_account(account);
870 static gint get_spool(FolderItem *dest, const gchar *mbox)
874 gchar tmp_mbox[256] = "/tmp/tmpmboxXXXXXX";
875 GHashTable *folder_table = NULL;
877 g_return_val_if_fail(dest != NULL, -1);
878 g_return_val_if_fail(mbox != NULL, -1);
880 if (!is_file_exist(mbox) || (size = get_file_size(mbox)) == 0) {
881 debug_print(_("no messages in local mailbox.\n"));
886 if ((lockfd = lock_mbox(mbox, LOCK_FLOCK)) < 0)
889 if (mktemp(tmp_mbox) == NULL)
892 if (copy_mbox(mbox, tmp_mbox) < 0)
895 debug_print(_("Getting new messages from %s into %s...\n"),
898 if (prefs_common.filter_on_inc)
899 folder_table = g_hash_table_new(NULL, NULL);
900 msgs = proc_mbox(dest, tmp_mbox, folder_table);
903 if (msgs >= 0) empty_mbox(mbox);
904 unlock_mbox(mbox, lockfd, LOCK_FLOCK);
907 folder_item_scan_foreach(folder_table);
908 folderview_update_item_foreach(folder_table);
909 g_hash_table_destroy(folder_table);
911 folder_item_scan(dest);
912 folderview_update_item(dest, FALSE);