2007-05-03 [wwp] 2.9.1cvs40
authorTristan Chabredier <wwp@claws-mail.org>
Thu, 3 May 2007 07:32:13 +0000 (07:32 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Thu, 3 May 2007 07:32:13 +0000 (07:32 +0000)
* src/plugins/spamassassin/spamassassin.c
* src/plugins/spamassassin/spamassassin.h
* src/plugins/spamassassin/spamassassin_gtk.c
* src/plugins/bogofilter/bogofilter.c
* src/plugins/bogofilter/bogofilter.h
* src/plugins/bogofilter/bogofilter_gtk.c
Added an option to conditionally mark saved spam
as read (default is and was to do so).
Satisfies feature request 1708539 on sf.net tracker.

ChangeLog
PATCHSETS
configure.ac
src/plugins/bogofilter/bogofilter.c
src/plugins/bogofilter/bogofilter.h
src/plugins/bogofilter/bogofilter_gtk.c
src/plugins/spamassassin/spamassassin.c
src/plugins/spamassassin/spamassassin.h
src/plugins/spamassassin/spamassassin_gtk.c

index ccbd639b357c37119eca3c1559d7e4d4f76c0875..8c425cbbadbfa259243864fcbfaff72a9a87c41a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2007-05-03 [wwp]       2.9.1cvs40
+
+       * src/plugins/spamassassin/spamassassin.c
+       * src/plugins/spamassassin/spamassassin.h
+       * src/plugins/spamassassin/spamassassin_gtk.c
+       * src/plugins/bogofilter/bogofilter.c
+       * src/plugins/bogofilter/bogofilter.h
+       * src/plugins/bogofilter/bogofilter_gtk.c
+               Added an option to conditionally mark saved spam
+               as read (default is and was to do so).
+               Satisfies feature request 1708539 on sf.net tracker.
+
 2007-05-03 [colin]     2.9.1cvs39
 
        * src/inc.c
index fbb52b2563dc2b0a0fb3b5b0dba7e2284b82618d..1aa853e955f00268d97168c35b6a6bb3c15bda80 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.14.2.17 -r 1.14.2.18 src/grouplistdialog.c;  ) > 2.9.1cvs37.patchset
 ( cvs diff -u -r 1.96.2.171 -r 1.96.2.172 src/textview.c;  ) > 2.9.1cvs38.patchset
 ( cvs diff -u -r 1.149.2.72 -r 1.149.2.73 src/inc.c;  ) > 2.9.1cvs39.patchset
+( cvs diff -u -r 1.18.2.51 -r 1.18.2.52 src/plugins/spamassassin/spamassassin.c;  cvs diff -u -r 1.4.2.14 -r 1.4.2.15 src/plugins/spamassassin/spamassassin.h;  cvs diff -u -r 1.23.2.37 -r 1.23.2.38 src/plugins/spamassassin/spamassassin_gtk.c;  cvs diff -u -r 1.1.2.29 -r 1.1.2.30 src/plugins/bogofilter/bogofilter.c;  cvs diff -u -r 1.1.2.11 -r 1.1.2.12 src/plugins/bogofilter/bogofilter.h;  cvs diff -u -r 1.1.2.23 -r 1.1.2.24 src/plugins/bogofilter/bogofilter_gtk.c;  ) > 2.9.1cvs40.patchset
index dd4d7616de9b066204e0f64f8e0bae5359d15f81..1a82bc51e14f131ddd5018411d99212d953a3133 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=1
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=39
+EXTRA_VERSION=40
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 0ca6aec4dbd4ba5a46ffcc8d3540116d342a1a64..e044ac405aa641d24e0bf9b37ee9c62d69874c4c 100644 (file)
@@ -102,6 +102,8 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"whitelist_ab_folder", "Any", &config.whitelist_ab_folder, P_STRING,
         NULL, NULL, NULL},
+       {"mark_as_read", "TRUE", &config.mark_as_read, P_BOOL,
+        NULL, NULL, NULL},
 
        {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
 };
@@ -546,7 +548,9 @@ static gboolean mail_filtering_hook(gpointer source, gpointer data)
        for (cur = new_spams; cur; cur = cur->next) {
                MsgInfo *msginfo = (MsgInfo *)cur->data;
                if (config.receive_spam) {
-                       procmsg_msginfo_change_flags(msginfo, MSG_SPAM, 0, ~0, 0);
+                       if (config.mark_as_read)
+                               procmsg_msginfo_unset_flags(msginfo, ~0, 0);
+                       procmsg_msginfo_set_flags(msginfo, MSG_SPAM, 0);
                } else {
                        folder_item_remove_msg(msginfo->folder, msginfo->msgnum);
                }
index 965851e1949b0fdbe4a7dc4e8d60fdb604ebd9b3..c92bd829f723fa0b9148200c46007b8f6d832580 100644 (file)
@@ -40,6 +40,7 @@ struct _BogofilterConfig
        gchar                   *whitelist_ab_folder;
        gboolean                 save_unsure;
        gchar                   *save_unsure_folder;
+       gboolean                 mark_as_read;
 };
 
 BogofilterConfig *bogofilter_get_config              (void);
index a41b93debcb05bb1da3db83c74de80e933ca57db..dcb787f5fea61677ce14fa4d25e2b4a32a3d53e2 100644 (file)
@@ -58,6 +58,7 @@ struct BogofilterPage
        GtkWidget *bogopath;
        GtkWidget *whitelist_ab;
        GtkWidget *whitelist_ab_folder_combo;
+       GtkWidget *mark_as_read;
 };
 
 /*!
@@ -105,6 +106,7 @@ static void bogofilter_create_widget_func(PrefsPage * _page,
        GtkWidget *hbox_max_size;
        GtkWidget *hbox_process_emails, *hbox_save_spam, *hbox_save_unsure;
        GtkWidget *hbox_bogopath, *hbox_whitelist;
+       GtkWidget *hbox_mark_as_read;
 
        GtkWidget *max_size_label;
        GtkObject *max_size_spinbtn_adj;
@@ -126,6 +128,8 @@ static void bogofilter_create_widget_func(PrefsPage * _page,
        GtkWidget *bogopath_label;
        GtkWidget *bogopath_entry;
 
+       GtkWidget *mark_as_read_checkbtn;
+
        GtkTooltips *tooltips;
 
        GtkWidget *whitelist_ab_folder_combo;
@@ -271,12 +275,21 @@ static void bogofilter_create_widget_func(PrefsPage * _page,
                        _("Path to bogofilter executable"),
                        NULL);
 
+       hbox_mark_as_read = gtk_hbox_new(FALSE, 8);
+       gtk_widget_show(hbox_mark_as_read);
+       gtk_box_pack_start (GTK_BOX (vbox2), hbox_mark_as_read, TRUE, TRUE, 0);
+
+       mark_as_read_checkbtn = gtk_check_button_new_with_label(_("Mark spam as read"));
+       gtk_widget_show(mark_as_read_checkbtn);
+       gtk_box_pack_start(GTK_BOX(hbox_mark_as_read), mark_as_read_checkbtn, FALSE, FALSE, 0);
+
        SET_TOGGLE_SENSITIVITY(save_spam_checkbtn, save_spam_folder_entry);
        SET_TOGGLE_SENSITIVITY(save_spam_checkbtn, save_spam_folder_select);
        SET_TOGGLE_SENSITIVITY(save_unsure_checkbtn, save_unsure_folder_entry);
        SET_TOGGLE_SENSITIVITY(save_unsure_checkbtn, save_unsure_folder_select);
        SET_TOGGLE_SENSITIVITY(whitelist_ab_checkbtn, whitelist_ab_folder_combo);
        SET_TOGGLE_SENSITIVITY(whitelist_ab_checkbtn, whitelist_ab_select_btn);
+       SET_TOGGLE_SENSITIVITY(save_spam_checkbtn, mark_as_read_checkbtn);
 
        config = bogofilter_get_config();
 
@@ -302,6 +315,7 @@ static void bogofilter_create_widget_func(PrefsPage * _page,
                gtk_entry_set_text(GTK_ENTRY(save_unsure_folder_entry), config->save_unsure_folder);
        if (config->bogopath != NULL)
                gtk_entry_set_text(GTK_ENTRY(bogopath_entry), config->bogopath);
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mark_as_read_checkbtn), config->mark_as_read);
 
        page->max_size = max_size_spinbtn;
        page->process_emails = process_emails_checkbtn;
@@ -319,6 +333,8 @@ static void bogofilter_create_widget_func(PrefsPage * _page,
        page->whitelist_ab_folder_combo = whitelist_ab_folder_combo;
        page->bogopath = bogopath_entry;
 
+       page->mark_as_read = mark_as_read_checkbtn;
+
        page->page.widget = vbox1;
 }
 
@@ -369,6 +385,9 @@ static void bogofilter_save_func(PrefsPage *_page)
        /* max_size */
        config->max_size = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(page->max_size));
 
+       /* mark_as_read */
+       config->mark_as_read = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->mark_as_read));
+
        if (config->process_emails) {
                bogofilter_register_hook();
        } else {
index 44caa9a973e7eec7eb87de167a4b0dd17a0d941f..cd4845cf7d37be13dd323d95e887893b03473cd2 100644 (file)
@@ -108,6 +108,8 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"username", "", &config.username, P_STRING,
         NULL, NULL, NULL},
+       {"mark_as_read", "TRUE", &config.mark_as_read, P_BOOL,
+        NULL, NULL, NULL},
 
        {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
 };
@@ -293,7 +295,8 @@ static gboolean mail_filtering_hook(gpointer source, gpointer data)
                                        save_folder = folder_get_default_trash();
                                }
                        }
-                       procmsg_msginfo_unset_flags(msginfo, ~0, 0);
+                       if (config.mark_as_read)
+                               procmsg_msginfo_unset_flags(msginfo, ~0, 0);
                        procmsg_msginfo_set_flags(msginfo, MSG_SPAM, 0);
                        msginfo->is_move = TRUE;
                        msginfo->to_filter_folder = save_folder;
index 08a3c5e15c8a74258f158a92504710c4b31ab2c3..32c0528629749314596aac0a61da75a56833d399 100644 (file)
@@ -47,6 +47,7 @@ struct _SpamAssassinConfig
        guint                    max_size;
        guint                    timeout;
        gchar                   *username;
+       gboolean                 mark_as_read;
 };
 
 SpamAssassinConfig *spamassassin_get_config          (void);
index ac1c553c0fdabf034f9fd80ae1957f59bf635025..6b1f6e8cd8541505a28fbdb15eece3b77b557072 100644 (file)
@@ -58,6 +58,7 @@ struct SpamAssassinPage
        GtkWidget *save_folder_select;
        GtkWidget *max_size;
        GtkWidget *timeout;
+       GtkWidget *mark_as_read;
 
        SpamAssassinTransport   trans;
 };
@@ -187,6 +188,7 @@ static void spamassassin_create_widget_func(PrefsPage * _page,
        GtkWidget *frame_transport, *table_transport, *vbox_transport;
        GtkWidget *hbox_spamd, *hbox_max_size, *hbox_timeout;
        GtkWidget *hbox_process_emails, *hbox_save_spam;
+       GtkWidget *hbox_mark_as_read;
 
        GtkWidget *enable_sa_checkbtn;
 
@@ -220,6 +222,8 @@ static void spamassassin_create_widget_func(PrefsPage * _page,
        GtkWidget *save_spam_folder_entry;
        GtkWidget *save_spam_folder_select;
 
+       GtkWidget *mark_as_read_checkbtn;
+
        GtkTooltips *tooltips;
 
        tooltips = gtk_tooltips_new();
@@ -387,6 +391,15 @@ static void spamassassin_create_widget_func(PrefsPage * _page,
                        _("Click this button to select a folder for storing spam"),
                        NULL);
 
+       hbox_mark_as_read = gtk_hbox_new(FALSE, 8);
+       gtk_widget_show(hbox_mark_as_read);
+       gtk_box_pack_start (GTK_BOX (vbox2), hbox_mark_as_read, TRUE, TRUE, 0);
+
+       mark_as_read_checkbtn = gtk_check_button_new_with_label(
+                       _("Mark spam as read"));
+       gtk_widget_show(mark_as_read_checkbtn);
+       gtk_box_pack_start(GTK_BOX(hbox_mark_as_read), mark_as_read_checkbtn, TRUE, TRUE, 0);
+
        SET_TOGGLE_SENSITIVITY(enable_sa_checkbtn, frame_transport);
        SET_TOGGLE_SENSITIVITY(enable_sa_checkbtn, hbox_max_size);
        SET_TOGGLE_SENSITIVITY(enable_sa_checkbtn, hbox_timeout);
@@ -394,6 +407,7 @@ static void spamassassin_create_widget_func(PrefsPage * _page,
        SET_TOGGLE_SENSITIVITY(save_spam_checkbtn, save_spam_folder_entry);
        SET_TOGGLE_SENSITIVITY(save_spam_checkbtn, save_spam_folder_select);
        SET_TOGGLE_SENSITIVITY(enable_sa_checkbtn, hbox_process_emails);
+       SET_TOGGLE_SENSITIVITY(save_spam_checkbtn, mark_as_read_checkbtn);
 
        config = spamassassin_get_config();
 
@@ -414,6 +428,7 @@ static void spamassassin_create_widget_func(PrefsPage * _page,
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(save_spam_checkbtn), config->receive_spam);
        if (config->save_folder != NULL)
                gtk_entry_set_text(GTK_ENTRY(save_spam_folder_entry), config->save_folder);
+       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mark_as_read_checkbtn), config->mark_as_read);
 
        page->enable_sa_checkbtn = enable_sa_checkbtn;
        page->transport_label = transport_label;
@@ -429,6 +444,7 @@ static void spamassassin_create_widget_func(PrefsPage * _page,
        page->receive_spam = save_spam_checkbtn;
        page->save_folder = save_spam_folder_entry;
        page->save_folder_select = save_spam_folder_select;
+       page->mark_as_read = mark_as_read_checkbtn;
 
        active = 0;
        for (i = 0; i < (sizeof(transports) / sizeof(struct Transport)); i++) {
@@ -511,6 +527,9 @@ static void spamassassin_save_func(PrefsPage *_page)
        /* timeout */
        config->timeout = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(page->timeout));
 
+       /* mark_as_read */
+       config->mark_as_read = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->mark_as_read));
+
        if (config->process_emails) {
                spamassassin_register_hook();
        } else {