changed german translation of undo
authorChristoph Hohmann <reboot@gmx.ch>
Mon, 3 Dec 2001 16:04:12 +0000 (16:04 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Mon, 3 Dec 2001 16:04:12 +0000 (16:04 +0000)
don't reinvent the wheel to traverse a GNode
seperate code to create the compose gui into functions add "Others" page with folder selection for saving copy of the message. the folder identifier is saved to queue header
save message to folder in queue header

ChangeLog.claws
configure.in
po/de.po
src/account.c
src/compose.c
src/compose.h
src/folder.c
src/procmsg.c

index 776a56f..c44ad7c 100644 (file)
@@ -1,3 +1,18 @@
+2001-03-12 [christoph] 0.6.5claws48
+
+       * po/de.po
+               changed translation of undo
+       * src/account.c
+       * src/folder.c
+               don't reinvent the wheel to traverse a GNode
+       * src/compose.[ch]
+               seperate code to create the compose gui into functions
+               add "Others" page with folder selection for saving copy
+               of the message.
+               the folder identifier is saved to queue header
+       * src/procmsg.c
+               save message to folder in queue header
+
 2001-12-03 [paul]      0.6.5claws47
 
        * sync with sylpheed 0.6.5cvs20
index f02ef39..aa221e3 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=5
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws47
+EXTRA_VERSION=claws48
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index 48926cd..d47ac75 100644 (file)
--- a/po/de.po
+++ b/po/de.po
@@ -690,7 +690,7 @@ msgstr "/_Datei/_Unterschrift einf
 
 #: src/compose.c:425
 msgid "/_Edit/_Undo"
-msgstr "/_Bearbeiten/_Zurück"
+msgstr "/_Bearbeiten/_Rückgängig"
 
 #: src/compose.c:426
 msgid "/_Edit/_Redo"
index 8b07889..63bf2fe 100644 (file)
@@ -567,24 +567,24 @@ static void account_edit_prefs(void)
        account_clist_set();
 }
 
-static void account_delete_references_recursive(const GNode *node, const gint account)
+static gboolean account_delete_references_func(GNode *node, gpointer data)
 {
-       /* the son */
-       if (node->data) {
-               FolderItem *item = node->data;
-               if (item->prefs) /* && item->prefs->stype == F_NORMAL */
-                       if (item->prefs->default_account == account) {
-                               item->prefs->enable_default_account = FALSE;
-                               item->prefs->default_account = 0;
-                               prefs_folder_item_save_config(item);
-                       }
-       }
-       /* its children (vertical dive) */
-       if (node->children)
-               account_delete_references_recursive(node->children, account);
-       /* its brothers (horizontal dive) */
-       if (node->next)
-               account_delete_references_recursive(node->next, account);
+       FolderItem *item;
+       gint account;
+
+       g_return_val_if_fail(node->data != NULL, FALSE);
+
+       item = FOLDER_ITEM(node->data);
+       account = GPOINTER_TO_INT(data);
+
+       if(!item->prefs) /* && item->prefs->stype == F_NORMAL */
+               return FALSE;
+       if(item->prefs->default_account != account)
+               return FALSE;
+       
+       item->prefs->enable_default_account = FALSE;
+       item->prefs->default_account = 0;
+       prefs_folder_item_save_config(item);
 }
 
 static void account_delete(void)
@@ -616,7 +616,10 @@ static void account_delete(void)
        for (; list != NULL; list = list->next) {
                folder = FOLDER(list->data);
                if (folder->node)  /* && folder->type == F_? */
-                       account_delete_references_recursive(folder->node, ac_prefs->account_id);
+                       g_node_traverse(folder->node, G_PRE_ORDER,
+                               G_TRAVERSE_ALL, -1,
+                               account_delete_references_func,
+                               GINT_TO_POINTER(ac_prefs->account_id));
        }
 }
 
index 76cfb86..9db8e5a 100644 (file)
 #include "quote_fmt.h"
 #include "template.h"
 #include "undo.h"
+#include "foldersel.h"
 
 #if USE_GPGME
 #  include "rfc2015.h"
@@ -3172,6 +3173,14 @@ static gint compose_queue(Compose *compose, gint *msgnum, FolderItem **item)
        if(newsac) {
                fprintf(fp, "NAID:%d\n", newsac->account_id);
        }
+       /* Save copy folder */
+       if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn))) {
+               gchar *str;
+               
+               str = gtk_editable_get_chars(GTK_EDITABLE(compose->savemsg_entry), 0, -1);
+               fprintf(fp, "SCF:%s\n", str);
+               g_free(str);
+       }
        fprintf(fp, "\n");
 
        while (fgets(buf, sizeof(buf), src_fp) != NULL) {
@@ -3711,7 +3720,8 @@ static void compose_add_entry_field(GtkWidget *table, GtkWidget **hbox,
        (*count)++;
 }
 
-static void compose_create_header_entry(Compose *compose) {
+static void compose_create_header_entry(Compose *compose) 
+{
        gchar *headers[] = {"To:", "Cc:", "Bcc:", "Newsgroups:", "Reply-To:", "Followup-To:", NULL};
 
        GtkWidget *combo;
@@ -3767,7 +3777,8 @@ static void compose_create_header_entry(Compose *compose) {
        compose->header_last = headerentry;
 }
 
-static void compose_add_header_entry(Compose *compose, gchar *header, gchar *text) {
+static void compose_add_header_entry(Compose *compose, gchar *header, gchar *text) 
+{
        ComposeHeaderEntry *last_header;
        
        last_header = compose->header_last;
@@ -3776,19 +3787,8 @@ static void compose_add_header_entry(Compose *compose, gchar *header, gchar *tex
        gtk_entry_set_text(GTK_ENTRY(last_header->entry), text);
 }
 
-static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
+static GtkWidget *compose_create_header(Compose *compose) 
 {
-       Compose   *compose;
-       GtkWidget *window;
-       GtkWidget *vbox;
-       GtkWidget *menubar;
-       GtkWidget *handlebox;
-
-       GtkWidget *notebook;
-
-       GtkWidget *vbox2;
-
-       GtkWidget *table_vbox;
        GtkWidget *label;
        GtkWidget *from_optmenu_hbox;
 #if 0 /* NEW COMPOSE GUI */
@@ -3810,97 +3810,14 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
        GtkWidget *followup_entry;
        GtkWidget *followup_hbox;
 #endif
-       GtkWidget *paned;
-
-       GtkWidget *attach_scrwin;
-       GtkWidget *attach_clist;
-
-       GtkWidget *edit_vbox;
-       GtkWidget *ruler_hbox;
-       GtkWidget *ruler;
-       GtkWidget *scrolledwin;
-       GtkWidget *text;
-
-       GtkWidget *table;
        GtkWidget *hbox;
 
-       UndoMain *undostruct;
-
-       gchar *titles[] = {_("MIME type"), _("Size"), _("Name")};
-       guint n_menu_entries;
-       GtkStyle  *style, *new_style;
-       GdkColormap *cmap;
-       GdkColor color[1];
-       gboolean success[1];
-       GdkFont   *font;
-       GtkWidget *popupmenu;
-       GtkWidget *menuitem;
-       GtkItemFactory *popupfactory;
-       GtkItemFactory *ifactory;
-       GtkWidget *tmpl_menu;
-       gint n_entries;
        gint count = 0;
-       gint i;
-
-#if USE_PSPELL
-        GtkPspell * gtkpspell = NULL;
-#endif
-
-       g_return_val_if_fail(account != NULL, NULL);
-
-       debug_print(_("Creating compose window...\n"));
-       compose = g_new0(Compose, 1);
-
-       compose->account = account;
-       compose->orig_account = account;
-
-       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-       gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, FALSE);
-       gtk_widget_set_usize(window, -1, prefs_common.compose_height);
-       gtk_signal_connect(GTK_OBJECT(window), "delete_event",
-                          GTK_SIGNAL_FUNC(compose_delete_cb), compose);
-       gtk_signal_connect(GTK_OBJECT(window), "destroy",
-                          GTK_SIGNAL_FUNC(compose_destroy_cb), compose);
-       gtk_signal_connect(GTK_OBJECT(window), "focus_in_event",
-                          GTK_SIGNAL_FUNC(manage_window_focus_in), NULL);
-       gtk_signal_connect(GTK_OBJECT(window), "focus_out_event",
-                          GTK_SIGNAL_FUNC(manage_window_focus_out), NULL);
-       gtk_widget_realize(window);
-
-       gtkut_widget_set_composer_icon(window);
-
-       vbox = gtk_vbox_new(FALSE, 0);
-       gtk_container_add(GTK_CONTAINER(window), vbox);
-
-       n_menu_entries = sizeof(compose_entries) / sizeof(compose_entries[0]);
-       menubar = menubar_create(window, compose_entries,
-                                n_menu_entries, "<Compose>", compose);
-       gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
-
-       handlebox = gtk_handle_box_new();
-       gtk_box_pack_start(GTK_BOX(vbox), handlebox, FALSE, FALSE, 0);
-
-       compose_toolbar_create(compose, handlebox);
-
-       vbox2 = gtk_vbox_new(FALSE, 2);
-       gtk_box_pack_start(GTK_BOX(vbox), vbox2, TRUE, TRUE, 0);
-       gtk_container_set_border_width(GTK_CONTAINER(vbox2), BORDER_WIDTH);
-
-       table_vbox = gtk_vbox_new(FALSE, 0);
-       gtk_box_pack_start(GTK_BOX(vbox2), table_vbox, FALSE, TRUE, 0);
-       gtk_container_set_border_width(GTK_CONTAINER(table_vbox),
-                                      BORDER_WIDTH * 2);
-
-       /* Notebook */
-       notebook = gtk_notebook_new();
-       gtk_widget_set_usize(notebook, -1, 180);
-       gtk_widget_show(notebook);
 
        /* header labels and entries */
        header_scrolledwin = gtk_scrolled_window_new(NULL, NULL);
        gtk_widget_show(header_scrolledwin);
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(header_scrolledwin), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-       gtk_notebook_append_page(GTK_NOTEBOOK(notebook), header_scrolledwin, gtk_label_new(_("Header")));
 
        header_table = gtk_table_new(2, 2, FALSE);
        gtk_widget_show(header_table);
@@ -3988,9 +3905,39 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
                           GTK_SIGNAL_FUNC(compose_grab_focus_cb), compose);
 #endif
 
+       compose->table            = NULL;
+#if 0 /* NEW COMPOSE GUI */
+       compose->table            = table;
+       compose->to_hbox          = to_hbox;
+       compose->to_entry         = to_entry;
+       compose->newsgroups_hbox  = newsgroups_hbox;
+       compose->newsgroups_entry = newsgroups_entry;
+#endif
+       compose->subject_entry    = subject_entry;
+#if 0 /* NEW COMPOSE GUI */
+       compose->cc_hbox          = cc_hbox;
+       compose->cc_entry         = cc_entry;
+       compose->bcc_hbox         = bcc_hbox;
+       compose->bcc_entry        = bcc_entry;
+       compose->reply_hbox       = reply_hbox;
+       compose->reply_entry      = reply_entry;
+       compose->followup_hbox    = followup_hbox;
+       compose->followup_entry   = followup_entry;
+#endif
+
+       return header_scrolledwin ;
+}
+
+GtkWidget *compose_create_attach(Compose *compose)
+{
+       gchar *titles[] = {_("MIME type"), _("Size"), _("Name")};
+       gint i;
+
+       GtkWidget *attach_scrwin;
+       GtkWidget *attach_clist;
+
        /* attachment list */
        attach_scrwin = gtk_scrolled_window_new(NULL, NULL);
-       gtk_notebook_append_page(GTK_NOTEBOOK(notebook), attach_scrwin, gtk_label_new(_("Attachments")));
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(attach_scrwin),
                                       GTK_POLICY_AUTOMATIC,
                                       GTK_POLICY_ALWAYS);
@@ -4024,6 +3971,181 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
                           GTK_SIGNAL_FUNC(compose_attach_drag_received_cb),
                           compose);
 
+       compose->attach_scrwin = attach_scrwin;
+       compose->attach_clist  = attach_clist;
+
+       return attach_scrwin;
+}
+
+static void compose_savemsg_checkbtn_cb(GtkWidget *widget, Compose *compose);
+static void compose_savemsg_select_cb(GtkWidget *widget, Compose *compose);
+
+static GtkWidget *compose_create_others(Compose *compose)
+{
+       GtkWidget *table;
+       GtkWidget *savemsg_checkbtn;
+       GtkWidget *savemsg_entry;
+       GtkWidget *savemsg_select;
+       
+       guint rowcount = 0;
+       gchar *folderidentifier;
+
+       /* Table for settings */
+       table = gtk_table_new(3, 1, FALSE);
+       gtk_widget_show(table);
+       gtk_table_set_row_spacings(GTK_TABLE(table), VSPACING_NARROW);
+       rowcount = 0;
+
+       /* Save Message to folder */
+       savemsg_checkbtn = gtk_check_button_new_with_label(_("Save Message to "));
+       gtk_widget_show(savemsg_checkbtn);
+       gtk_table_attach(GTK_TABLE(table), savemsg_checkbtn, 0, 1, rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(savemsg_checkbtn), prefs_common.savemsg);
+       gtk_signal_connect(GTK_OBJECT(savemsg_checkbtn), "toggled",
+                           GTK_SIGNAL_FUNC(compose_savemsg_checkbtn_cb), compose);
+
+       savemsg_entry = gtk_entry_new();
+       gtk_widget_show(savemsg_entry);
+       gtk_table_attach_defaults(GTK_TABLE(table), savemsg_entry, 1, 2, rowcount, rowcount + 1);
+       gtk_editable_set_editable(GTK_EDITABLE(savemsg_entry), prefs_common.savemsg);
+       folderidentifier = folder_item_get_identifier(folder_get_default_outbox());
+       gtk_entry_set_text(GTK_ENTRY(savemsg_entry), folderidentifier);
+       g_free(folderidentifier);
+
+       savemsg_select = gtk_button_new_with_label (_("Select ..."));
+       gtk_widget_show (savemsg_select);
+       gtk_table_attach(GTK_TABLE(table), savemsg_select, 2, 3, rowcount, rowcount + 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 0, 0);
+       gtk_signal_connect (GTK_OBJECT (savemsg_select), "clicked",
+                           GTK_SIGNAL_FUNC (compose_savemsg_select_cb),
+                           compose);
+
+       rowcount++;
+
+       compose->savemsg_checkbtn = savemsg_checkbtn;
+       compose->savemsg_entry = savemsg_entry;
+
+       return table;   
+}
+
+static void compose_savemsg_checkbtn_cb(GtkWidget *widget, Compose *compose) 
+{
+       gtk_editable_set_editable(GTK_EDITABLE(compose->savemsg_entry),
+               gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn)));
+}
+
+static void compose_savemsg_select_cb(GtkWidget *widget, Compose *compose)
+{
+       FolderItem *dest;
+       gchar * path;
+
+       dest = foldersel_folder_sel(NULL, NULL);
+       if (!dest) return;
+
+       path = folder_item_get_identifier(dest);
+
+       gtk_entry_set_text(GTK_ENTRY(compose->savemsg_entry), path);
+       g_free(path);
+}
+
+static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
+{
+       Compose   *compose;
+       GtkWidget *window;
+       GtkWidget *vbox;
+       GtkWidget *menubar;
+       GtkWidget *handlebox;
+
+       GtkWidget *notebook;
+
+       GtkWidget *vbox2;
+
+       GtkWidget *table_vbox;
+
+       GtkWidget *paned;
+
+       GtkWidget *edit_vbox;
+       GtkWidget *ruler_hbox;
+       GtkWidget *ruler;
+       GtkWidget *scrolledwin;
+       GtkWidget *text;
+
+       GtkWidget *table;
+
+       UndoMain *undostruct;
+
+       guint n_menu_entries;
+       GtkStyle  *style, *new_style;
+       GdkColormap *cmap;
+       GdkColor color[1];
+       gboolean success[1];
+       GdkFont   *font;
+       GtkWidget *popupmenu;
+       GtkWidget *menuitem;
+       GtkItemFactory *popupfactory;
+       GtkItemFactory *ifactory;
+       GtkWidget *tmpl_menu;
+       gint n_entries;
+
+#if USE_PSPELL
+        GtkPspell * gtkpspell = NULL;
+#endif
+
+       g_return_val_if_fail(account != NULL, NULL);
+
+       debug_print(_("Creating compose window...\n"));
+       compose = g_new0(Compose, 1);
+
+       compose->account = account;
+       compose->orig_account = account;
+
+       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+       gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, FALSE);
+       gtk_widget_set_usize(window, -1, prefs_common.compose_height);
+       gtk_signal_connect(GTK_OBJECT(window), "delete_event",
+                          GTK_SIGNAL_FUNC(compose_delete_cb), compose);
+       gtk_signal_connect(GTK_OBJECT(window), "destroy",
+                          GTK_SIGNAL_FUNC(compose_destroy_cb), compose);
+       gtk_signal_connect(GTK_OBJECT(window), "focus_in_event",
+                          GTK_SIGNAL_FUNC(manage_window_focus_in), NULL);
+       gtk_signal_connect(GTK_OBJECT(window), "focus_out_event",
+                          GTK_SIGNAL_FUNC(manage_window_focus_out), NULL);
+       gtk_widget_realize(window);
+
+       gtkut_widget_set_composer_icon(window);
+
+       vbox = gtk_vbox_new(FALSE, 0);
+       gtk_container_add(GTK_CONTAINER(window), vbox);
+
+       n_menu_entries = sizeof(compose_entries) / sizeof(compose_entries[0]);
+       menubar = menubar_create(window, compose_entries,
+                                n_menu_entries, "<Compose>", compose);
+       gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
+
+       handlebox = gtk_handle_box_new();
+       gtk_box_pack_start(GTK_BOX(vbox), handlebox, FALSE, FALSE, 0);
+
+       compose_toolbar_create(compose, handlebox);
+
+       vbox2 = gtk_vbox_new(FALSE, 2);
+       gtk_box_pack_start(GTK_BOX(vbox), vbox2, TRUE, TRUE, 0);
+       gtk_container_set_border_width(GTK_CONTAINER(vbox2), BORDER_WIDTH);
+
+       table_vbox = gtk_vbox_new(FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(vbox2), table_vbox, FALSE, TRUE, 0);
+       gtk_container_set_border_width(GTK_CONTAINER(table_vbox),
+                                      BORDER_WIDTH * 2);
+
+       /* Notebook */
+       notebook = gtk_notebook_new();
+       gtk_widget_set_usize(notebook, -1, 180);
+       gtk_widget_show(notebook);
+
+       /* header labels and entries */
+       gtk_notebook_append_page(GTK_NOTEBOOK(notebook), compose_create_header(compose), gtk_label_new(_("Header")));
+       /* attachment list */
+       gtk_notebook_append_page(GTK_NOTEBOOK(notebook), compose_create_attach(compose), gtk_label_new(_("Attachments")));
+       /* Others Tab */
+       gtk_notebook_append_page(GTK_NOTEBOOK(notebook), compose_create_others(compose), gtk_label_new(_("Others")));
 
        edit_vbox = gtk_vbox_new(FALSE, 0);
 #if 0 /* NEW COMPOSE GUI */
@@ -4210,29 +4332,8 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
        compose->vbox2         = vbox2;
 
        compose->table_vbox       = table_vbox;
-       compose->table            = NULL;
-#if 0 /* NEW COMPOSE GUI */
-       compose->table            = table;
-       compose->to_hbox          = to_hbox;
-       compose->to_entry         = to_entry;
-       compose->newsgroups_hbox  = newsgroups_hbox;
-       compose->newsgroups_entry = newsgroups_entry;
-#endif
-       compose->subject_entry    = subject_entry;
-#if 0 /* NEW COMPOSE GUI */
-       compose->cc_hbox          = cc_hbox;
-       compose->cc_entry         = cc_entry;
-       compose->bcc_hbox         = bcc_hbox;
-       compose->bcc_entry        = bcc_entry;
-       compose->reply_hbox       = reply_hbox;
-       compose->reply_entry      = reply_entry;
-       compose->followup_hbox    = followup_hbox;
-       compose->followup_entry   = followup_entry;
-#endif
-       compose->paned = paned;
 
-       compose->attach_scrwin = attach_scrwin;
-       compose->attach_clist  = attach_clist;
+       compose->paned = paned;
 
        compose->edit_vbox     = edit_vbox;
        compose->ruler_hbox    = ruler_hbox;
index 765ac65..e186c86 100644 (file)
@@ -93,6 +93,7 @@ struct _Compose
 
        GtkWidget *vbox2;
 
+       /* Header */
        GtkWidget *table_vbox;
        GtkWidget *table;
 /*
@@ -114,9 +115,15 @@ struct _Compose
 */
        GtkWidget *paned;
 
+       /* Attachments */
        GtkWidget *attach_scrwin;
        GtkWidget *attach_clist;
 
+       /* Others */
+       GtkWidget *savemsg_checkbtn;
+       GtkWidget *savemsg_entry;
+
+       /* Textedit */
        GtkWidget *edit_vbox;
        GtkWidget *ruler_hbox;
        GtkWidget *ruler;
index e755422..824ad98 100644 (file)
@@ -361,39 +361,54 @@ void folder_write_list(void)
                g_warning("failed to write folder list.\n");
 }
 
-static void folder_count_total_msgs_func(GNode *node, guint *new,
-                                        guint *unread, guint *total)
+struct TotalMsgCount
 {
-       g_return_if_fail(node != NULL);
+       guint new;
+       guint unread;
+       guint total;
+};
 
-       if (node->data) {
-               FolderItem *item = FOLDER_ITEM(node->data);
-               *new += item->new;
-               *unread += item->unread;
-               *total += item->total;
-       }
+static gboolean folder_count_total_msgs_func(GNode *node, gpointer data)
+{
+       FolderItem *item;
+       struct TotalMsgCount *totalmsgcount;
+
+       g_return_val_if_fail(node->data != NULL, FALSE);
 
-       if (node->children)
-               folder_count_total_msgs_func(node->children,
-                                            new, unread, total);
-       if (node->next)
-               folder_count_total_msgs_func(node->next, new, unread, total);
+       totalmsgcount = (struct TotalMsgCount *)data;
+       item = FOLDER_ITEM(node->data);
+       totalmsgcount->new += item->new;
+       totalmsgcount->unread += item->unread;
+       totalmsgcount->total += item->total;
+       
+       return FALSE;
 }
 
 void folder_count_total_msgs(guint *new, guint *unread, guint *total)
 {
        GList *list;
        Folder *folder;
-
-       *new = *unread = *total = 0;
+       struct TotalMsgCount totalmsgcount;
 
        debug_print(_("Counting total number of messages...\n"));
 
+       totalmsgcount.new = 0;
+       totalmsgcount.unread = 0;
+       totalmsgcount.total = 0;
+
        for (list = folder_list; list != NULL; list = list->next) {
                folder = FOLDER(list->data);
-               folder_count_total_msgs_func(folder->node, new, unread, total);
+               if(folder->node)
+                       g_node_traverse(folder->node, G_PRE_ORDER,
+                               G_TRAVERSE_ALL, -1,
+                               folder_count_total_msgs_func,
+                               &totalmsgcount);
        }
 
+       *new = totalmsgcount.new;
+       *unread = totalmsgcount.unread;
+       *total = totalmsgcount.total;
+
        return;
 }
 
@@ -1496,8 +1511,7 @@ FolderItem * folder_find_item_from_identifier(const gchar *identifier)
        gchar * name;
        gchar * path;
 
-       Xalloca(str, strlen(identifier) + 1, return NULL);
-       strcpy(str, identifier);
+       Xstrdup_a(str, identifier, return NULL);
 
        /* extract box type */
 
index c141f09..94142f9 100644 (file)
@@ -945,12 +945,13 @@ static gint procmsg_cmp_flag_msgnum(gconstpointer a, gconstpointer b)
 
 enum
 {
-       Q_SENDER          = 0,
-       Q_SMTPSERVER      = 1,
-       Q_RECIPIENTS      = 2,
-       Q_NEWSGROUPS      = 3,
-       Q_MAIL_ACCOUNT_ID = 4,
-       Q_NEWS_ACCOUNT_ID = 5
+       Q_SENDER           = 0,
+       Q_SMTPSERVER       = 1,
+       Q_RECIPIENTS       = 2,
+       Q_NEWSGROUPS       = 3,
+       Q_MAIL_ACCOUNT_ID  = 4,
+       Q_NEWS_ACCOUNT_ID  = 5,
+       Q_SAVE_COPY_FOLDER = 6
 };
 
 gint procmsg_send_message_queue(const gchar *file)
@@ -961,6 +962,7 @@ gint procmsg_send_message_queue(const gchar *file)
                                       {"NG:",   NULL, FALSE},
                                       {"MAID:", NULL, FALSE},
                                       {"NAID:", NULL, FALSE},
+                                      {"SCF:",  NULL, FALSE},
                                       {NULL,    NULL, FALSE}};
        FILE *fp;
        gint filepos;
@@ -969,6 +971,7 @@ gint procmsg_send_message_queue(const gchar *file)
        gchar *smtpserver = NULL;
        GSList *to_list = NULL;
        GSList *newsgroup_list = NULL;
+       gchar *savecopyfolder = NULL;
        gchar buf[BUFFSIZE];
        gint hnum;
        PrefsAccount *mailac = NULL, *newsac = NULL;
@@ -1004,6 +1007,9 @@ gint procmsg_send_message_queue(const gchar *file)
                case Q_NEWS_ACCOUNT_ID:
                        newsac = account_find_from_id(atoi(p));
                        break;
+               case Q_SAVE_COPY_FOLDER:
+                       if (!savecopyfolder) savecopyfolder = g_strdup(p);
+                       break;
                default:
                }
        }
@@ -1085,21 +1091,23 @@ gint procmsg_send_message_queue(const gchar *file)
        }
 
        /* save message to outbox */
-       if (mailval == 0 && newsval == 0 && prefs_common.savemsg) {
-               FolderItem *outbox;
+       if (mailval == 0 && newsval == 0 && savecopyfolder) {
+               FolderItem *folder;
                gchar *path;
                gint num;
                FILE *fp;
 
                debug_print(_("saving sent message...\n"));
 
-               outbox = folder_get_default_outbox();
-               path = folder_item_get_path(outbox);
+               folder = folder_find_item_from_identifier(savecopyfolder);
+               if(!folder)
+                       folder = folder_get_default_outbox();
+               path = folder_item_get_path(folder);
                if (!is_dir_exist(path))
                        make_dir_hier(path);
 
-               folder_item_scan(outbox);
-               if ((num = folder_item_add_msg(outbox, tmp, FALSE)) < 0) {
+               folder_item_scan(folder);
+               if ((num = folder_item_add_msg(folder, tmp, FALSE)) < 0) {
                        g_warning(_("can't save message\n"));
                }