5c2a96851ba50b5dea50c96da1608a54e7358320
[claws.git] / src / main.c
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2002 Hiroyuki Yamamoto
4  *
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.
9  *
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.
14  *
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.
18  */
19
20 #ifdef HAVE_CONFIG_H
21 #  include "config.h"
22 #endif
23
24 #include "defs.h"
25
26 #include <glib.h>
27 #include <gtk/gtkmain.h>
28 #include <gtk/gtkrc.h>
29
30 #if HAVE_GDK_IMLIB
31 #  include <gdk_imlib.h>
32 #endif
33
34 #include <stdio.h>
35 #include <stdlib.h>
36 #include <string.h>
37 #include <ctype.h>
38 #include <unistd.h>
39 #include <time.h>
40 #include <sys/stat.h>
41 #include <sys/types.h>
42 #include <signal.h>
43
44 #if HAVE_LOCALE_H
45 #  include <locale.h>
46 #endif
47
48 #if USE_GPGME
49 #  include <gpgme.h>
50 #  include "passphrase.h"
51 #endif
52
53 #include "intl.h"
54 #include "main.h"
55 #include "mainwindow.h"
56 #include "folderview.h"
57 #include "summaryview.h"
58 #include "prefs_common.h"
59 #include "prefs_filter.h"
60 #include "prefs_account.h"
61 #include "prefs_actions.h"
62 #include "scoring.h"
63 #include "prefs_display_header.h"
64 #include "account.h"
65 #include "procmsg.h"
66 #include "inc.h"
67 #include "import.h"
68 #include "manage_window.h"
69 #include "alertpanel.h"
70 #include "statusbar.h"
71 #include "addressbook.h"
72 #include "compose.h"
73 #include "folder.h"
74 #include "setup.h"
75 #include "utils.h"
76 #include "gtkutils.h"
77
78 #if USE_GPGME
79 #  include "rfc2015.h"
80 #endif
81 #if USE_SSL
82 #  include "ssl.h"
83 #endif
84
85 #include "version.h"
86
87 #include "crash.h"
88
89 gchar *prog_version;
90 gchar *startup_dir;
91 gchar *argv0;
92 gboolean debug_mode = FALSE;
93
94 static gint lock_socket = -1;
95 static gint lock_socket_tag = 0;
96
97 static struct Cmd {
98         gboolean receive;
99         gboolean receive_all;
100         gboolean compose;
101         const gchar *compose_mailto;
102         GPtrArray *attach_files;
103         gboolean status;
104         gboolean send;
105         gboolean crash;
106         gchar   *crash_params;
107 } cmd;
108
109 static void parse_cmd_opt(int argc, char *argv[]);
110
111 #if USE_GPGME
112 static void idle_function_for_gpgme(void);
113 #endif /* USE_GPGME */
114
115 static gint prohibit_duplicate_launch   (void);
116 static void lock_socket_input_cb        (gpointer          data,
117                                          gint              source,
118                                          GdkInputCondition condition);
119 #ifndef CLAWS                                    
120 static 
121 #endif
122 gchar *get_socket_name          (void);
123
124
125 static void open_compose_new            (const gchar    *address,
126                                          GPtrArray      *attach_files);
127
128 static void send_queue                  (void);
129 static void initial_processing          (FolderItem *item, gpointer data);
130
131 #if 0
132 /* for gettext */
133 _("File `%s' already exists.\n"
134   "Can't create folder.")
135 #endif
136
137 #define MAKE_DIR_IF_NOT_EXIST(dir) \
138 { \
139         if (!is_dir_exist(dir)) { \
140                 if (is_file_exist(dir)) { \
141                         alertpanel_warning \
142                                 (_("File `%s' already exists.\n" \
143                                    "Can't create folder."), \
144                                  dir); \
145                         return 1; \
146                 } \
147                 if (make_dir(dir) < 0) \
148                         return 1; \
149         } \
150 }
151
152 int main(int argc, char *argv[])
153 {
154         gchar *userrc;
155         MainWindow *mainwin;
156         FolderView *folderview;
157
158         setlocale(LC_ALL, "");
159         bindtextdomain(PACKAGE, LOCALEDIR);
160         textdomain(PACKAGE);
161
162         prog_version = PROG_VERSION;
163         startup_dir = g_get_current_dir();
164         argv0 = g_strdup(argv[0]);
165
166         parse_cmd_opt(argc, argv);
167
168         gtk_set_locale();
169         gtk_init(&argc, &argv);
170
171         if (cmd.crash) {
172                 crash_main(cmd.crash_params);
173                 return 0;
174         }
175
176         crash_install_handlers();
177
178 #if USE_THREADS || USE_LDAP
179         g_thread_init(NULL);
180         if (!g_thread_supported())
181                 g_error(_("g_thread is not supported by glib.\n"));
182 #endif
183
184 #if HAVE_GDK_IMLIB
185         gdk_imlib_init();
186         gtk_widget_push_visual(gdk_imlib_get_visual());
187         gtk_widget_push_colormap(gdk_imlib_get_colormap());
188 #endif
189
190 #if USE_SSL
191         ssl_init();
192 #endif
193
194         srandom((gint)time(NULL));
195
196         /* parse gtkrc files */
197         userrc = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S, ".gtkrc",
198                              NULL);
199         gtk_rc_parse(userrc);
200         g_free(userrc);
201         userrc = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S, ".gtk",
202                              G_DIR_SEPARATOR_S, "gtkrc", NULL);
203         gtk_rc_parse(userrc);
204         g_free(userrc);
205         userrc = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, "gtkrc", NULL);
206         gtk_rc_parse(userrc);
207         g_free(userrc);
208
209         gtk_rc_parse("./gtkrc");
210
211         userrc = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, MENU_RC, NULL);
212         gtk_item_factory_parse_rc(userrc);
213         g_free(userrc);
214
215         CHDIR_RETURN_VAL_IF_FAIL(get_home_dir(), 1);
216
217         /* check and create unix domain socket */
218         lock_socket = prohibit_duplicate_launch();
219         if (lock_socket < 0) return 0;
220
221         if (cmd.status) {
222                 puts("0 Sylpheed not running.");
223                 return 0;
224         }
225
226         /* backup if old rc file exists */
227         if (is_file_exist(RC_DIR)) {
228                 if (rename(RC_DIR, RC_DIR ".bak") < 0)
229                         FILE_OP_ERROR(RC_DIR, "rename");
230         }
231         MAKE_DIR_IF_NOT_EXIST(RC_DIR);
232         MAKE_DIR_IF_NOT_EXIST(get_imap_cache_dir());
233         MAKE_DIR_IF_NOT_EXIST(get_news_cache_dir());
234         MAKE_DIR_IF_NOT_EXIST(get_mime_tmp_dir());
235         MAKE_DIR_IF_NOT_EXIST(get_tmp_dir());
236         MAKE_DIR_IF_NOT_EXIST(RC_DIR G_DIR_SEPARATOR_S "uidl");
237
238         if (is_file_exist(RC_DIR G_DIR_SEPARATOR_S "sylpheed.log")) {
239                 if (rename(RC_DIR G_DIR_SEPARATOR_S "sylpheed.log",
240                            RC_DIR G_DIR_SEPARATOR_S "sylpheed.log.bak") < 0)
241                         FILE_OP_ERROR("sylpheed.log", "rename");
242         }
243         set_log_file(RC_DIR G_DIR_SEPARATOR_S "sylpheed.log");
244
245         if (is_file_exist(RC_DIR G_DIR_SEPARATOR_S "assortrc") &&
246             !is_file_exist(RC_DIR G_DIR_SEPARATOR_S "filterrc")) {
247                 if (rename(RC_DIR G_DIR_SEPARATOR_S "assortrc",
248                            RC_DIR G_DIR_SEPARATOR_S "filterrc") < 0)
249                         FILE_OP_ERROR(RC_DIR G_DIR_SEPARATOR_S "assortrc",
250                                       "rename");
251         }
252
253         prefs_common_init();
254         prefs_common_read_config();
255
256 #if USE_GPGME
257         if (gpgme_check_engine()) {  /* Also does some gpgme init */
258                 rfc2015_disable_all();
259                 debug_print("gpgme_engine_version:\n%s\n",
260                             gpgme_get_engine_info());
261
262                 if (prefs_common.gpg_warning) {
263                         AlertValue val;
264
265                         val = alertpanel_message_with_disable
266                                 (_("Warning"),
267                                  _("GnuPG is not installed properly, or needs to be upgraded.\n"
268                                    "OpenPGP support disabled."));
269                         if (val & G_ALERTDISABLE)
270                                 prefs_common.gpg_warning = FALSE;
271                 }
272         }
273         gpgme_register_idle(idle_function_for_gpgme);
274 #endif
275
276 #if USE_ASPELL
277         gtkaspellcheckers = gtkaspell_checkers_new();
278 #endif
279         
280
281         prefs_common_save_config();
282         prefs_filter_read_config();
283         prefs_filter_write_config();
284         prefs_actions_read_config();
285         prefs_actions_write_config();
286         prefs_display_header_read_config();
287         prefs_display_header_write_config();
288         /* prefs_filtering_read_config(); */
289         addressbook_read_file();
290         renderer_read_config();
291
292         gtkut_widget_init();
293
294         mainwin = main_window_create
295                 (prefs_common.sep_folder | prefs_common.sep_msg << 1);
296         folderview = mainwin->folderview;
297
298         /* register the callback of unix domain socket input */
299         lock_socket_tag = gdk_input_add(lock_socket,
300                                         GDK_INPUT_READ | GDK_INPUT_EXCEPTION,
301                                         lock_socket_input_cb,
302                                         mainwin);
303
304         account_read_config_all();
305         account_save_config_all();
306
307         if (folder_read_list() < 0) {
308                 setup(mainwin);
309                 folder_write_list();
310         }
311         if (!account_get_list()) {
312                 account_edit_open();
313                 account_add();
314         }
315
316         account_set_missing_folder();
317         folder_set_missing_folders();
318         folderview_set(folderview);
319
320         /* prefs_scoring_read_config(); */
321         prefs_matcher_read_config();
322
323         /* make one all-folder processing before using sylpheed */
324         folder_func_to_all_folders(initial_processing, (gpointer *)mainwin);
325
326         addressbook_read_file();
327
328         inc_autocheck_timer_init(mainwin);
329
330         /* ignore SIGPIPE signal for preventing sudden death of program */
331         signal(SIGPIPE, SIG_IGN);
332
333         if (cmd.receive_all || prefs_common.chk_on_startup)
334                 inc_all_account_mail(mainwin, prefs_common.newmail_notify_manu);
335         else if (cmd.receive)
336                 inc_mail(mainwin, prefs_common.newmail_notify_manu);
337         else
338                 gtk_widget_grab_focus(folderview->ctree);
339
340         if (cmd.compose)
341                 open_compose_new(cmd.compose_mailto, cmd.attach_files);
342         if (cmd.attach_files) {
343                 ptr_array_free_strings(cmd.attach_files);
344                 g_ptr_array_free(cmd.attach_files, TRUE);
345                 cmd.attach_files = NULL;
346         }
347         if (cmd.send)
348                 send_queue();
349
350         gtk_main();
351
352         addressbook_destroy();
353
354 #if USE_ASPELL       
355         gtkaspell_checkers_delete();
356 #endif
357
358         return 0;
359 }
360
361 static void parse_cmd_opt(int argc, char *argv[])
362 {
363         gint i;
364
365         for (i = 1; i < argc; i++) {
366                 if (!strncmp(argv[i], "--debug", 7))
367                         debug_mode = TRUE;
368                 else if (!strncmp(argv[i], "--receive-all", 13))
369                         cmd.receive_all = TRUE;
370                 else if (!strncmp(argv[i], "--receive", 9))
371                         cmd.receive = TRUE;
372                 else if (!strncmp(argv[i], "--compose", 9)) {
373                         const gchar *p = argv[i + 1];
374
375                         cmd.compose = TRUE;
376                         cmd.compose_mailto = NULL;
377                         if (p && *p != '\0' && *p != '-') {
378                                 if (!strncmp(p, "mailto:", 7))
379                                         cmd.compose_mailto = p + 7;
380                                 else
381                                         cmd.compose_mailto = p;
382                                 i++;
383                         }
384                 } else if (!strncmp(argv[i], "--attach", 8)) {
385                         const gchar *p = argv[i + 1];
386                         gchar *file;
387
388                         while (p && *p != '\0' && *p != '-') {
389                                 if (!cmd.attach_files)
390                                         cmd.attach_files = g_ptr_array_new();
391                                 if (*p != G_DIR_SEPARATOR)
392                                         file = g_strconcat(startup_dir,
393                                                            G_DIR_SEPARATOR_S,
394                                                            p, NULL);
395                                 else
396                                         file = g_strdup(p);
397                                 g_ptr_array_add(cmd.attach_files, file);
398                                 i++;
399                                 p = argv[i + 1];
400                         }
401                 } else if (!strncmp(argv[i], "--send", 6)) {
402                         cmd.send = TRUE;
403                 } else if (!strncmp(argv[i], "--version", 9)) {
404                         puts("Sylpheed version " VERSION);
405                         exit(0);
406                 } else if (!strncmp(argv[i], "--status", 8)) {
407                         cmd.status = TRUE;
408                 } else if (!strncmp(argv[i], "--help", 6)) {
409                         g_print(_("Usage: %s [OPTION]...\n"),
410                                 g_basename(argv[0]));
411
412                         puts(_("  --compose [address]    open composition window"));
413                         puts(_("  --attach file1 [file2]...\n"
414                                "                         open composition window with specified files\n"
415                                "                         attached"));
416                         puts(_("  --receive              receive new messages"));
417                         puts(_("  --receive-all          receive new messages of all accounts"));
418                         puts(_("  --send                 send all queued messages"));
419                         puts(_("  --status               show the total number of messages"));
420                         puts(_("  --debug                debug mode"));
421                         puts(_("  --help                 display this help and exit"));
422                         puts(_("  --version              output version information and exit"));
423
424                         exit(1);
425                 } else if (!strncmp(argv[i], "--crash", 7)) {
426                         cmd.crash = TRUE;
427                         cmd.crash_params = g_strdup(argv[i + 1]);
428                         i++;
429                 }
430                 
431         }
432
433         if (cmd.attach_files && cmd.compose == FALSE) {
434                 cmd.compose = TRUE;
435                 cmd.compose_mailto = NULL;
436         }
437 }
438
439 static gint get_queued_message_num(void)
440 {
441         FolderItem *queue;
442
443         queue = folder_get_default_queue();
444         if (!queue) return -1;
445
446         folder_item_scan(queue);
447         return queue->total;
448 }
449
450 static void save_all_caches(FolderItem *item, gpointer data)
451 {
452         if(!item->cache)
453                 return;
454                 
455         folder_item_write_cache(item);
456 }
457
458 static void initial_processing(FolderItem *item, gpointer data)
459 {
460         MainWindow *mainwin = (MainWindow *)data;
461         gchar *buf;
462
463         g_return_if_fail(item);
464         buf = g_strdup_printf(_("Processing (%s)..."), 
465                               item->path 
466                               ? item->path 
467                               : _("top level folder"));
468         debug_print("%s\n", buf);
469         g_free(buf);
470
471         main_window_cursor_wait(mainwin);
472         
473         folder_item_apply_processing(item);
474
475         debug_print("done.\n");
476         STATUSBAR_POP(mainwin);
477         main_window_cursor_normal(mainwin);
478 }
479
480 void app_will_exit(GtkWidget *widget, gpointer data)
481 {
482         MainWindow *mainwin = data;
483         gchar *filename;
484
485         if (compose_get_compose_list()) {
486                 if (alertpanel(_("Notice"),
487                                _("Composing message exists. Really quit?"),
488                                _("OK"), _("Cancel"), NULL) != G_ALERTDEFAULT)
489                         return;
490                 manage_window_focus_in(mainwin->window, NULL, NULL);
491         }
492
493         if (prefs_common.warn_queued_on_exit && get_queued_message_num() > 0) {
494                 if (alertpanel(_("Queued messages"),
495                                _("Some unsent messages are queued. Exit now?"),
496                                _("OK"), _("Cancel"), NULL) != G_ALERTDEFAULT)
497                         return;
498                 manage_window_focus_in(mainwin->window, NULL, NULL);
499         }
500
501         inc_autocheck_timer_remove();
502
503 #if USE_GPGME
504         gpgmegtk_free_passphrase();
505 #endif
506
507         if (prefs_common.clean_on_exit)
508                 main_window_empty_trash(mainwin, prefs_common.ask_on_clean);
509
510         /* save prefs for opened folder */
511         if(mainwin->folderview->opened)
512         {
513                 FolderItem *item;
514
515                 item = gtk_ctree_node_get_row_data(GTK_CTREE(mainwin->folderview->ctree), mainwin->folderview->opened);
516                 summary_save_prefs_to_folderitem(mainwin->folderview->summaryview, item);
517         }
518
519         /* save all state before exiting */
520         folder_write_list();
521         folder_func_to_all_folders(save_all_caches, NULL);
522
523         main_window_get_size(mainwin);
524         main_window_get_position(mainwin);
525         prefs_common_save_config();
526         prefs_filter_write_config();
527         account_save_config_all();
528         addressbook_export_to_file();
529
530         filename = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, MENU_RC, NULL);
531         gtk_item_factory_dump_rc(filename, NULL, TRUE);
532         g_free(filename);
533
534         /* delete temporary files */
535         remove_all_files(get_mime_tmp_dir());
536
537         close_log_file();
538
539         /* delete unix domain socket */
540         gdk_input_remove(lock_socket_tag);
541         fd_close(lock_socket);
542         filename = get_socket_name();
543         unlink(filename);
544
545 #if USE_SSL
546         ssl_done();
547 #endif
548
549         gtk_main_quit();
550 }
551
552 #if USE_GPGME
553 static void idle_function_for_gpgme(void)
554 {
555         while (gtk_events_pending())
556                 gtk_main_iteration();
557 }
558 #endif /* USE_GPGME */
559
560 /*
561  * CLAWS: want this public so crash dialog can delete the
562  * lock file too
563  */
564 #ifndef CLAWS
565 static
566 #endif
567 gchar *get_socket_name(void)
568 {
569         static gchar *filename = NULL;
570
571         if (filename == NULL) {
572                 filename = g_strdup_printf("%s%csylpheed-%d",
573                                            g_get_tmp_dir(), G_DIR_SEPARATOR,
574                                            getuid());
575         }
576
577         return filename;
578 }
579
580 static gint prohibit_duplicate_launch(void)
581 {
582         gint uxsock;
583         gchar *path;
584
585         path = get_socket_name();
586         uxsock = fd_connect_unix(path);
587         if (uxsock < 0) {
588                 unlink(path);
589                 return fd_open_unix(path);
590         }
591
592         /* remote command mode */
593
594         debug_print("another Sylpheed is already running.\n");
595
596         if (cmd.receive_all)
597                 fd_write(uxsock, "receive_all\n", 12);
598         else if (cmd.receive)
599                 fd_write(uxsock, "receive\n", 8);
600         else if (cmd.compose && cmd.attach_files) {
601                 gchar *str, *compose_str;
602                 gint i;
603
604                 if (cmd.compose_mailto)
605                         compose_str = g_strdup_printf("compose_attach %s\n",
606                                                       cmd.compose_mailto);
607                 else
608                         compose_str = g_strdup("compose_attach\n");
609
610                 fd_write(uxsock, compose_str, strlen(compose_str));
611                 g_free(compose_str);
612
613                 for (i = 0; i < cmd.attach_files->len; i++) {
614                         str = g_ptr_array_index(cmd.attach_files, i);
615                         fd_write(uxsock, str, strlen(str));
616                         fd_write(uxsock, "\n", 1);
617                 }
618
619                 fd_write(uxsock, ".\n", 2);
620         } else if (cmd.compose) {
621                 gchar *compose_str;
622
623                 if (cmd.compose_mailto)
624                         compose_str = g_strdup_printf("compose %s\n", cmd.compose_mailto);
625                 else
626                         compose_str = g_strdup("compose\n");
627
628                 fd_write(uxsock, compose_str, strlen(compose_str));
629                 g_free(compose_str);
630         } else if (cmd.send) {
631                 fd_write(uxsock, "send\n", 5);
632         } else if (cmd.status) {
633                 gchar buf[BUFFSIZE];
634
635                 fd_write(uxsock, "status\n", 7);
636                 fd_gets(uxsock, buf, sizeof(buf));
637                 fputs(buf, stdout);
638         } else
639                 fd_write(uxsock, "popup\n", 6);
640
641         fd_close(uxsock);
642         return -1;
643 }
644
645 static void lock_socket_input_cb(gpointer data,
646                                  gint source,
647                                  GdkInputCondition condition)
648 {
649         MainWindow *mainwin = (MainWindow *)data;
650         gint sock;
651         gchar buf[BUFFSIZE];
652
653         sock = fd_accept(source);
654         fd_gets(sock, buf, sizeof(buf));
655
656         if (!strncmp(buf, "popup", 5)) {
657                 main_window_popup(mainwin);
658         } else if (!strncmp(buf, "receive_all", 11)) {
659                 main_window_popup(mainwin);
660                 inc_all_account_mail(mainwin, prefs_common.newmail_notify_manu);
661         } else if (!strncmp(buf, "receive", 7)) {
662                 main_window_popup(mainwin);
663                 inc_mail(mainwin, prefs_common.newmail_notify_manu);
664         } else if (!strncmp(buf, "compose_attach", 14)) {
665                 GPtrArray *files;
666                 gchar *mailto;
667
668                 mailto = g_strdup(buf + strlen("compose_attach") + 1);
669                 files = g_ptr_array_new();
670                 while (fd_gets(sock, buf, sizeof(buf)) > 0) {
671                         if (buf[0] == '.' && buf[1] == '\n') break;
672                         strretchomp(buf);
673                         g_ptr_array_add(files, g_strdup(buf));
674                 }
675                 open_compose_new(mailto, files);
676                 ptr_array_free_strings(files);
677                 g_ptr_array_free(files, TRUE);
678                 g_free(mailto);
679         } else if (!strncmp(buf, "compose", 7)) {
680                 open_compose_new(buf + strlen("compose") + 1, NULL);
681         } else if (!strncmp(buf, "send", 4)) {
682                 send_queue();
683         } else if (!strncmp(buf, "status", 6)) {
684                 guint new, unread, total;
685
686                 folder_count_total_msgs(&new, &unread, &total);
687                 g_snprintf(buf, sizeof(buf), "%d %d %d\n", new, unread, total);
688                 fd_write(sock, buf, strlen(buf));
689         }
690
691         fd_close(sock);
692 }
693
694 static void open_compose_new(const gchar *address, GPtrArray *attach_files)
695 {
696         gchar *addr = NULL;
697
698         if (address) {
699                 Xstrdup_a(addr, address, return);
700                 g_strstrip(addr);
701         }
702
703         compose_new(NULL, addr, attach_files);
704 }
705
706 static void send_queue(void)
707 {
708         GList *list;
709         FolderItem *def_outbox;
710
711         def_outbox = folder_get_default_outbox();
712
713         for (list = folder_get_list(); list != NULL; list = list->next) {
714                 Folder *folder = list->data;
715
716                 if (folder->queue) {
717                         if (procmsg_send_queue
718                                 (folder->queue, prefs_common.savemsg) < 0)
719                                 alertpanel_error(_("Some errors occurred while sending queued messages."));
720                         statusbar_pop_all();
721                         folder_item_scan(folder->queue);
722                         folderview_update_item(folder->queue, TRUE);
723                         if (prefs_common.savemsg && folder->outbox) {
724                                 folderview_update_item(folder->outbox, TRUE);
725                                 if (folder->outbox == def_outbox)
726                                         def_outbox = NULL;
727                         }
728                 }
729         }
730
731         if (prefs_common.savemsg && def_outbox)
732                 folderview_update_item(def_outbox, TRUE);
733 }