static PrefParam param[] = {
{"process_emails", "TRUE", &config.process_emails, P_BOOL,
NULL, NULL, NULL},
- {"receive_spam", "TRUE", &config.receive_spam, P_BOOL,
+ {"receive_spam", "1", &config.receive_spam, P_INT,
NULL, NULL, NULL},
{"save_folder", NULL, &config.save_folder, P_STRING,
NULL, NULL, NULL},
if (!whitelisted && parts && parts[0] && parts[1] && *parts[1] == 'S') {
debug_print("message %d is spam\n", msginfo->msgnum);
- /* Spam will be filtered away */
- data->mail_filtering_data->filtered = g_slist_prepend(
- data->mail_filtering_data->filtered, msginfo);
+ /* Spam will be filtered away, unless we want "mark only".
+ * In that case, we want it among unfiltered messages, so
+ * it gets processed further. */
+ if (config.receive_spam == SPAM_MARK_ONLY) {
+ data->mail_filtering_data->unfiltered = g_slist_prepend(
+ data->mail_filtering_data->unfiltered, msginfo);
+ } else {
+ data->mail_filtering_data->filtered = g_slist_prepend(
+ data->mail_filtering_data->filtered, msginfo);
+ }
data->new_spams = g_slist_prepend(data->new_spams, msginfo);
} else if (whitelisted && parts && parts[0] && parts[1] &&
}
}
- /* flag spams and delete them if !config.receive_spam
- * (if config.receive_spam is set, we'll move them later) */
+ /* flag spams and delete them if config.receive_spam == 0
+ * (if config.receive_spam is set to 1, we'll move them later,
+ * mark as spam only if set to 2) */
for (cur = new_spams; cur; cur = cur->next) {
MsgInfo *msginfo = (MsgInfo *)cur->data;
- if (config.receive_spam) {
+ if (config.receive_spam != SPAM_DELETE) {
if (config.mark_as_read)
procmsg_msginfo_unset_flags(msginfo, ~0, 0);
procmsg_msginfo_set_flags(msginfo, MSG_SPAM, 0);
mail_filtering_data->filtered = NULL;
mail_filtering_data->unfiltered = NULL;
} else {
- if (config.receive_spam && new_spams) {
+ if (config.receive_spam == SPAM_MARK_AND_SAVE && new_spams) {
FolderItem *save_folder = NULL;
if ((!config.save_folder) ||
}
}
+static void spam_handle_combobox_callback(GtkWidget *widget, gpointer user_data)
+{
+ GtkWidget *hbox = GTK_WIDGET(user_data);
+
+ if (gtk_combo_box_get_active(GTK_COMBO_BOX(widget)) == 1) {
+ gtk_widget_set_sensitive(hbox, TRUE);
+ } else {
+ gtk_widget_set_sensitive(hbox, FALSE);
+ }
+}
+
#ifndef USE_NEW_ADDRBOOK
static void bogofilter_whitelist_ab_select_cb(GtkWidget *widget, gpointer data)
{
GtkWidget *process_emails_checkbtn;
- GtkWidget *save_spam_checkbtn;
+ GtkWidget *spam_handle_label;
+ GtkWidget *spam_handle_combobox;
GtkWidget *save_spam_folder_entry;
GtkWidget *save_spam_folder_select;
gtk_widget_show(hbox_save_spam);
gtk_box_pack_start (GTK_BOX (vbox2), hbox_save_spam, TRUE, TRUE, 0);
- save_spam_checkbtn = gtk_check_button_new_with_label(_("Save spam in"));
- gtk_widget_show(save_spam_checkbtn);
- gtk_box_pack_start(GTK_BOX(hbox_save_spam), save_spam_checkbtn, FALSE, FALSE, 0);
+#if !GTK_CHECK_VERSION(2, 24, 0)
+ spam_handle_combobox = gtk_combo_box_new_text();
+#else
+ spam_handle_combobox = gtk_combo_box_text_new();
+#endif
+
+#if !GTK_CHECK_VERSION(2, 24, 0)
+ gtk_combo_box_append_text(GTK_COMBO_BOX(spam_handle_combobox),
+#else
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(spam_handle_combobox),
+#endif
+ _("Delete spam"));
+
+#if !GTK_CHECK_VERSION(2, 24, 0)
+ gtk_combo_box_append_text(GTK_COMBO_BOX(spam_handle_combobox),
+#else
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(spam_handle_combobox),
+#endif
+ _("Save spam in..."));
+
+#if !GTK_CHECK_VERSION(2, 24, 0)
+ gtk_combo_box_append_text(GTK_COMBO_BOX(spam_handle_combobox),
+#else
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(spam_handle_combobox),
+#endif
+ _("Only mark as spam"));
+
+ gtk_widget_show(spam_handle_combobox);
+ gtk_box_pack_start(GTK_BOX(hbox_save_spam), spam_handle_combobox, FALSE, FALSE, 0);
+
+ GtkWidget *hbox = gtk_hbox_new(FALSE, 8);
+ gtk_widget_show(hbox);
+ gtk_box_pack_start (GTK_BOX (hbox_save_spam), hbox, TRUE, TRUE, 0);
save_spam_folder_entry = gtk_entry_new();
gtk_widget_show (save_spam_folder_entry);
- gtk_box_pack_start (GTK_BOX (hbox_save_spam), save_spam_folder_entry, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), save_spam_folder_entry, TRUE, TRUE, 0);
CLAWS_SET_TIP(save_spam_folder_entry,
_("Folder for storing identified spam. Leave empty to use the trash folder."));
save_spam_folder_select = gtkut_get_browse_directory_btn(_("_Browse"));
gtk_widget_show (save_spam_folder_select);
- gtk_box_pack_start (GTK_BOX (hbox_save_spam), save_spam_folder_select, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), save_spam_folder_select, FALSE, FALSE, 0);
CLAWS_SET_TIP(save_spam_folder_select,
_("Click this button to select a folder for storing spam"));
+ g_signal_connect(G_OBJECT(spam_handle_combobox), "changed",
+ G_CALLBACK(spam_handle_combobox_callback), (gpointer)hbox);
+
hbox_save_unsure = gtk_hbox_new(FALSE, 8);
gtk_widget_show(hbox_save_unsure);
gtk_box_pack_start (GTK_BOX (vbox2), hbox_save_unsure, TRUE, TRUE, 0);
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);
#endif
SET_TOGGLE_SENSITIVITY(whitelist_ab_checkbtn, learn_from_whitelist_chkbtn);
- SET_TOGGLE_SENSITIVITY(save_spam_checkbtn, mark_as_read_checkbtn);
config = bogofilter_get_config();
#endif
gtk_spin_button_set_value(GTK_SPIN_BUTTON(max_size_spinbtn), (float) config->max_size);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(process_emails_checkbtn), config->process_emails);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(save_spam_checkbtn), config->receive_spam);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(spam_handle_combobox), config->receive_spam);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(save_unsure_checkbtn), config->save_unsure);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(insert_header_checkbtn), config->insert_header);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(whitelist_ab_checkbtn), config->whitelist_ab);
page->max_size = max_size_spinbtn;
page->process_emails = process_emails_checkbtn;
- page->receive_spam = save_spam_checkbtn;
+ page->receive_spam = spam_handle_combobox;
page->save_folder = save_spam_folder_entry;
page->save_folder_select = save_spam_folder_select;
config->process_emails = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->process_emails));
/* receive_spam */
- config->receive_spam = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->receive_spam));
+ config->receive_spam = gtk_combo_box_get_active(GTK_COMBO_BOX(page->receive_spam));
/* save_folder */
g_free(config->save_folder);