2007-06-04 [wwp] 2.9.2cvs33
authorTristan Chabredier <wwp@claws-mail.org>
Mon, 4 Jun 2007 13:28:06 +0000 (13:28 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Mon, 4 Jun 2007 13:28:06 +0000 (13:28 +0000)
* src/account.c
* src/prefs_account.c
* src/prefs_account.h
* src/procmsg.c
It's now possible to disable mail filtering plugins
on a per-account basis.

ChangeLog
PATCHSETS
configure.ac
src/account.c
src/prefs_account.c
src/prefs_account.h
src/procmsg.c

index a50a7f8e59854e39eec152032b5c91d3b9089f50..c04a33077bcb81e96bd1493024669076092960ee 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-06-04 [wwp]       2.9.2cvs33
+
+       * src/account.c
+       * src/prefs_account.c
+       * src/prefs_account.h
+       * src/procmsg.c
+               It's now possible to disable mail filtering plugins
+               on a per-account basis.
+
 2007-06-04 [wwp]       2.9.2cvs32
 
        * src/procheader.c
index 8d174490210d176c22f22e1666d96aa498431fe1..d5f8899ca841eadbcb8623b86f7d9da7f18c145e 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.10.2.31 -r 1.10.2.32 src/prefs_gtk.c;  ) > 2.9.2cvs30.patchset
 ( cvs diff -u -r 1.105.2.97 -r 1.105.2.98 src/prefs_account.c;  ) > 2.9.2cvs31.patchset
 ( cvs diff -u -r 1.47.2.42 -r 1.47.2.43 src/procheader.c;  cvs diff -u -r 1.36.2.102 -r 1.36.2.103 src/common/utils.c;  cvs diff -u -r 1.20.2.45 -r 1.20.2.46 src/common/utils.h;  ) > 2.9.2cvs32.patchset
+( cvs diff -u -r 1.61.2.63 -r 1.61.2.64 src/account.c;  cvs diff -u -r 1.105.2.98 -r 1.105.2.99 src/prefs_account.c;  cvs diff -u -r 1.49.2.29 -r 1.49.2.30 src/prefs_account.h;  cvs diff -u -r 1.150.2.95 -r 1.150.2.96 src/procmsg.c;  ) > 2.9.2cvs33.patchset
index 6281cca51df770e892ff4967c40424ca7b07a924..4057876727459451f3fb040f5c3f467d7263ff38 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=32
+EXTRA_VERSION=33
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 6730bf4ab6d6acf0038a9d0dee13cb0f35697510..ef8a2569e341bb3dc8b24cf8cca4a40bc05f27e7 100644 (file)
@@ -925,10 +925,10 @@ static void account_clone(GtkWidget *widget, gpointer data)
        ACP_FASSIGN(msg_leave_time);
        ACP_FASSIGN(recv_at_getall);
        ACP_FASSIGN(sd_rmmail_on_download);
-       ACP_FASSIGN(sd_filter_on_recv);
        ACP_FASSIGN(enable_size_limit);
        ACP_FASSIGN(size_limit);
        ACP_FASSIGN(filter_on_recv);
+       ACP_FASSIGN(filterhook_on_recv);
        ACP_FDUP(inbox);
        ACP_FASSIGN(max_articles);
 
index ffb08f653e785a3f8d1be567c8da20cf9510954a..2698b9f7b22b08cf125758180a51abfe9b6b2471 100644 (file)
@@ -129,6 +129,7 @@ typedef struct ReceivePage
        GtkWidget *local_inbox_btn;
 
        GtkWidget *filter_on_recv_checkbtn;
+       GtkWidget *filterhook_on_recv_checkbtn;
        GtkWidget *recvatgetall_checkbtn;
        
        GtkWidget *imap_frame;
@@ -333,6 +334,8 @@ static void prefs_account_nntpauth_toggled(GtkToggleButton *button,
                                           gpointer user_data);
 static void prefs_account_mailcmd_toggled(GtkToggleButton *button,
                                          gpointer user_data);
+static void prefs_account_filter_on_recv_toggled(GtkToggleButton *button,
+                                         gpointer user_data);
 
 #if USE_ASPELL
 static void prefs_account_compose_default_dictionary_set_string_from_optmenu
@@ -430,6 +433,10 @@ static PrefParam receive_param[] = {
         &receive_page.filter_on_recv_checkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
 
+       {"filterhook_on_receive", "TRUE", &tmp_ac_prefs.filterhook_on_recv, P_BOOL,
+        &receive_page.filterhook_on_recv_checkbtn,
+        prefs_set_data_from_toggle, prefs_set_toggle},
+
        {"imap_auth_method", "0", &tmp_ac_prefs.imap_auth_type, P_ENUM,
         &receive_page.imap_auth_type_optmenu,
         prefs_account_imap_auth_type_set_data_from_optmenu,
@@ -1263,6 +1270,7 @@ static void receive_create_widget_func(PrefsPage * _page,
        GtkTooltips *size_limit_tooltip;
        GtkWidget *label;
        GtkWidget *filter_on_recv_checkbtn;
+       GtkWidget *filterhook_on_recv_checkbtn;
        GtkWidget *vbox3;
        GtkWidget *inbox_label;
        GtkWidget *inbox_entry;
@@ -1500,6 +1508,13 @@ static void receive_create_widget_func(PrefsPage * _page,
        PACK_CHECK_BUTTON (vbox1, filter_on_recv_checkbtn,
                           _("Filter messages on receiving"));
 
+       g_signal_connect(G_OBJECT(filter_on_recv_checkbtn), "toggled",
+                        G_CALLBACK(prefs_account_filter_on_recv_toggled),
+                        NULL);
+
+       PACK_CHECK_BUTTON (vbox1, filterhook_on_recv_checkbtn,
+                          _("Allow filtering using plug-ins on receiving"));
+
        PACK_CHECK_BUTTON
                (vbox1, recvatgetall_checkbtn,
                 _("'Get Mail' checks for new messages on this account"));
@@ -1511,6 +1526,7 @@ static void receive_create_widget_func(PrefsPage * _page,
        page->size_limit_checkbtn        = size_limit_checkbtn;
        page->size_limit_entry         = size_limit_entry;
        page->filter_on_recv_checkbtn    = filter_on_recv_checkbtn;
+       page->filterhook_on_recv_checkbtn = filterhook_on_recv_checkbtn;
        page->inbox_label              = inbox_label;
        page->inbox_entry              = inbox_entry;
        page->inbox_btn                = inbox_btn;
@@ -3729,6 +3745,8 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
                gtk_widget_hide(receive_page.local_frame);
                gtk_widget_show(receive_page.frame_maxarticle);
                gtk_widget_set_sensitive(receive_page.filter_on_recv_checkbtn, TRUE);
+               prefs_account_filter_on_recv_toggled
+                       (GTK_TOGGLE_BUTTON(receive_page.filter_on_recv_checkbtn), NULL);
                gtk_widget_set_sensitive(receive_page.recvatgetall_checkbtn, TRUE);
                /* update pop_before_smtp sensitivity */
                gtk_toggle_button_set_active
@@ -3740,6 +3758,9 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
                        gtk_toggle_button_set_active
                                (GTK_TOGGLE_BUTTON(receive_page.filter_on_recv_checkbtn), 
                                TRUE);
+                       gtk_toggle_button_set_active
+                               (GTK_TOGGLE_BUTTON(receive_page.filterhook_on_recv_checkbtn), 
+                               TRUE);
                        gtk_toggle_button_set_active
                                (GTK_TOGGLE_BUTTON(receive_page.recvatgetall_checkbtn),
                                 FALSE);
@@ -3812,6 +3833,8 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
                gtk_widget_show(receive_page.local_frame);
                gtk_widget_hide(receive_page.frame_maxarticle);
                gtk_widget_set_sensitive(receive_page.filter_on_recv_checkbtn, TRUE);
+               prefs_account_filter_on_recv_toggled
+                       (GTK_TOGGLE_BUTTON(receive_page.filter_on_recv_checkbtn), NULL);
                gtk_widget_set_sensitive(receive_page.recvatgetall_checkbtn, TRUE);
                prefs_account_mailcmd_toggled
                        (GTK_TOGGLE_BUTTON(basic_page.mailcmd_checkbtn), NULL);
@@ -3826,6 +3849,9 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
                        gtk_toggle_button_set_active
                                (GTK_TOGGLE_BUTTON(receive_page.filter_on_recv_checkbtn), 
                                TRUE);
+                       gtk_toggle_button_set_active
+                               (GTK_TOGGLE_BUTTON(receive_page.filterhook_on_recv_checkbtn), 
+                               TRUE);
                        gtk_toggle_button_set_active
                                (GTK_TOGGLE_BUTTON(receive_page.recvatgetall_checkbtn),
                                 TRUE);
@@ -3903,6 +3929,8 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
                gtk_widget_hide(receive_page.local_frame);
                gtk_widget_hide(receive_page.frame_maxarticle);
                gtk_widget_set_sensitive(receive_page.filter_on_recv_checkbtn, TRUE);
+               prefs_account_filter_on_recv_toggled
+                       (GTK_TOGGLE_BUTTON(receive_page.filter_on_recv_checkbtn), NULL);
                gtk_widget_set_sensitive(receive_page.recvatgetall_checkbtn, TRUE);
                gtk_widget_set_sensitive(basic_page.smtpserv_entry, TRUE);
                gtk_widget_set_sensitive(basic_page.smtpserv_label, TRUE);
@@ -3917,6 +3945,9 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
                        gtk_toggle_button_set_active
                                (GTK_TOGGLE_BUTTON(receive_page.filter_on_recv_checkbtn), 
                                TRUE);
+                       gtk_toggle_button_set_active
+                               (GTK_TOGGLE_BUTTON(receive_page.filterhook_on_recv_checkbtn), 
+                               TRUE);
                        gtk_toggle_button_set_active
                                (GTK_TOGGLE_BUTTON(receive_page.recvatgetall_checkbtn),
                                 FALSE);
@@ -3993,6 +4024,8 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
                gtk_widget_hide(receive_page.local_frame);
                gtk_widget_hide(receive_page.frame_maxarticle);
                gtk_widget_set_sensitive(receive_page.filter_on_recv_checkbtn, FALSE);
+               prefs_account_filter_on_recv_toggled
+                       (GTK_TOGGLE_BUTTON(receive_page.filter_on_recv_checkbtn), NULL);
                gtk_widget_set_sensitive(receive_page.recvatgetall_checkbtn, FALSE);
 
                gtk_widget_set_sensitive(basic_page.smtpserv_entry, TRUE);
@@ -4004,6 +4037,8 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
        
                gtk_toggle_button_set_active
                        (GTK_TOGGLE_BUTTON(receive_page.filter_on_recv_checkbtn), FALSE);
+               gtk_toggle_button_set_active
+                       (GTK_TOGGLE_BUTTON(receive_page.filterhook_on_recv_checkbtn), FALSE);
                gtk_toggle_button_set_active
                        (GTK_TOGGLE_BUTTON(receive_page.recvatgetall_checkbtn), FALSE);
 
@@ -4079,6 +4114,8 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
                gtk_widget_hide(receive_page.local_frame);
                gtk_widget_hide(receive_page.frame_maxarticle);
                gtk_widget_set_sensitive(receive_page.filter_on_recv_checkbtn, TRUE);
+               prefs_account_filter_on_recv_toggled
+                       (GTK_TOGGLE_BUTTON(receive_page.filter_on_recv_checkbtn), NULL);
                gtk_widget_set_sensitive(receive_page.recvatgetall_checkbtn, TRUE);
 
                gtk_widget_set_sensitive(basic_page.smtpserv_entry, TRUE);
@@ -4092,6 +4129,9 @@ static void prefs_account_protocol_changed(GtkComboBox *combobox, gpointer data)
                        gtk_toggle_button_set_active
                                (GTK_TOGGLE_BUTTON(receive_page.filter_on_recv_checkbtn), 
                                TRUE);
+                       gtk_toggle_button_set_active
+                               (GTK_TOGGLE_BUTTON(receive_page.filterhook_on_recv_checkbtn), 
+                               TRUE);
                        gtk_toggle_button_set_active
                                (GTK_TOGGLE_BUTTON(receive_page.recvatgetall_checkbtn),
                                 TRUE);
@@ -4150,6 +4190,15 @@ static void prefs_account_mailcmd_toggled(GtkToggleButton *button,
        gtk_widget_set_sensitive(basic_page.pass_entry, !use_mailcmd);
 }
 
+static void prefs_account_filter_on_recv_toggled(GtkToggleButton *button,
+                                         gpointer user_data)
+{
+       gboolean do_filter;
+
+       do_filter = gtk_toggle_button_get_active (button);
+       gtk_widget_set_sensitive(receive_page.filterhook_on_recv_checkbtn, do_filter);
+}
+
 #if USE_ASPELL
 static void prefs_account_compose_default_dictionary_set_string_from_optmenu
                                                        (PrefParam *pparam)
index 99cc8510c72cc5c196487292d8bf41786b1ee544..cba11291dcdd5bb7519fc3f0fbf258ea06a70d36 100644 (file)
@@ -87,10 +87,10 @@ struct _PrefsAccount
        gint msg_leave_time;
        gboolean recv_at_getall;
        gboolean sd_rmmail_on_download;
-       gboolean sd_filter_on_recv;
        gboolean enable_size_limit;
        gint size_limit;
        gboolean filter_on_recv;
+       gboolean filterhook_on_recv;
        gchar *inbox;
        gchar *local_inbox;
        gint max_articles;
index 588b896ca20229150b8aeea09be610e3e122631e..d010cfa1761c57614135c374070db8bb567bb369 100644 (file)
@@ -2117,9 +2117,10 @@ static gboolean procmsg_msginfo_filter(MsgInfo *msginfo, PrefsAccount* ac_prefs)
        mail_filtering_data.filtered = NULL;                    
        mail_filtering_data.unfiltered = NULL;
        mail_filtering_data.account = ac_prefs; 
-       if (hooks_invoke(MAIL_FILTERING_HOOKLIST, &mail_filtering_data)) {
+
+       if (!ac_prefs || ac_prefs->filterhook_on_recv)
+               if (hooks_invoke(MAIL_FILTERING_HOOKLIST, &mail_filtering_data))
                return TRUE;
-       }
 
        /* filter if enabled in prefs or move to inbox if not */
        if((filtering_rules != NULL) &&
@@ -2164,6 +2165,7 @@ void procmsg_msglist_filter(GSList *list, PrefsAccount *ac,
        mail_filtering_data.unfiltered = NULL;  
        mail_filtering_data.account = ac;       
                        
+       if (!ac || ac->filterhook_on_recv)
        hooks_invoke(MAIL_LISTFILTERING_HOOKLIST, &mail_filtering_data);
        
        if (mail_filtering_data.filtered == NULL &&