+2006-12-15 [paul] 2.6.1cvs36
+
+ * src/plugins/bogofilter/bogofilter.c
+ * src/plugins/bogofilter/bogofilter.h
+ * src/plugins/bogofilter/bogofilter_gtk.c
+ Add an option to allow inserting an
+ X-Claws-Bogosity header (on MH folders
+ only). Patch by Colin
+
2006-12-14 [colin] 2.6.1cvs35
* src/main.c
( cvs diff -u -r 1.94.2.111 -r 1.94.2.112 src/messageview.c; cvs diff -u -r 1.19.2.11 -r 1.19.2.12 src/messageview.h; cvs diff -u -r 1.83.2.93 -r 1.83.2.94 src/mimeview.c; cvs diff -u -r 1.20.2.16 -r 1.20.2.17 src/mimeview.h; cvs diff -u -r 1.395.2.271 -r 1.395.2.272 src/summaryview.c; cvs diff -u -r 1.96.2.161 -r 1.96.2.162 src/textview.c; cvs diff -u -r 1.12.2.15 -r 1.12.2.16 src/textview.h; cvs diff -u -r 1.1.2.5 -r 1.1.2.6 src/gtk/gtksourceprintjob.c; ) > 2.6.1cvs33.patchset
( cvs diff -u -r 1.1.2.28 -r 1.1.2.29 src/prefs_summaries.c; cvs diff -u -r 1.1.2.36 -r 1.1.2.37 manual/advanced.xml; ) > 2.6.1cvs34.patchset
( cvs diff -u -r 1.115.2.119 -r 1.115.2.120 src/main.c; ) > 2.6.1cvs35.patchset
+( cvs diff -u -r 1.1.2.15 -r 1.1.2.16 src/plugins/bogofilter/bogofilter.c; cvs diff -u -r 1.1.2.4 -r 1.1.2.5 src/plugins/bogofilter/bogofilter.h; cvs diff -u -r 1.1.2.8 -r 1.1.2.9 src/plugins/bogofilter/bogofilter_gtk.c; ) > 2.6.1cvs36.patchset
MICRO_VERSION=1
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=35
+EXTRA_VERSION=36
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
NULL, NULL, NULL},
{"bogopath", "bogofilter", &config.bogopath, P_STRING,
NULL, NULL, NULL},
+ {"insert_header", "FALSE", &config.insert_header, P_BOOL,
+ NULL, NULL, NULL},
{NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
};
/* can set flags (SCANNED, ATTACHMENT) but that's ok
* as GUI updates are hooked not direct */
file = procmsg_get_message_file(msginfo);
-
if (file) {
gchar *tmp = g_strdup_printf("%s\n",file);
write_all(bogo_stdin, tmp, strlen(tmp));
}
parts = g_strsplit(tmp, " ", 0);
debug_print("read %s\n", buf);
+ if (parts && parts[0] && parts[1] && parts[2] &&
+ FOLDER_TYPE(msginfo->folder->folder) == F_MH &&
+ config.insert_header) {
+ gchar *tmpfile = get_tmp_file();
+ FILE *input = fopen(file, "r");
+ FILE *output = fopen(tmpfile, "w");
+ if (strstr(parts[2], "\n"))
+ *(strstr(parts[2], "\n")) = '\0';
+ if (input && !output)
+ fclose (input);
+ else if (!input && output)
+ fclose (output);
+ else {
+ gchar tmpbuf[BUFFSIZE];
+ const gchar *bogosity = *parts[1] == 'S' ? "Spam":
+ (*parts[1] == 'H' ? "Ham":"Unsure");
+ gchar *tmpstr = g_strdup_printf(
+ "X-Claws-Bogosity: %s, spamicity=%s\n",
+ bogosity, parts[2]);
+ fwrite(tmpstr, 1, strlen(tmpstr), output);
+ while (fgets(tmpbuf, sizeof(buf), input))
+ fputs(tmpbuf, output);
+ fclose(input);
+ fclose(output);
+ move_file(tmpfile, file, TRUE);
+ g_free(tmpstr);
+ }
+ g_free(tmpfile);
+ }
if (parts && parts[0] && parts[1] && *parts[1] == 'S') {
debug_print("message %d is spam\n", msginfo->msgnum);
if (config.receive_spam) {
gchar *save_folder;
guint max_size;
gchar *bogopath;
+ gboolean insert_header;
};
BogofilterConfig *bogofilter_get_config (void);
GtkWidget *receive_spam;
GtkWidget *save_folder;
GtkWidget *save_folder_select;
+ GtkWidget *insert_header;
GtkWidget *max_size;
GtkWidget *bogopath;
};
GtkWidget *save_spam_folder_entry;
GtkWidget *save_spam_folder_select;
+ GtkWidget *insert_header_chkbtn;
GtkWidget *bogopath_label;
GtkWidget *bogopath_entry;
_("Click this button to select a folder for storing spam"),
NULL);
+ insert_header_chkbtn = gtk_check_button_new_with_label(_("Insert X-Bogosity header"));
+ gtk_widget_show(insert_header_chkbtn);
+ gtk_box_pack_start(GTK_BOX(vbox2), insert_header_chkbtn, FALSE, FALSE, 0);
+ gtk_tooltips_set_tip(tooltips, insert_header_chkbtn,
+ _("Only done for mails in MH folders"),
+ NULL);
+
hbox_bogopath = gtk_hbox_new(FALSE, 8);
gtk_widget_show(hbox_bogopath);
gtk_box_pack_start (GTK_BOX (vbox2), hbox_bogopath, 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_spam_checkbtn, insert_header_chkbtn);
config = bogofilter_get_config();
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_toggle_button_set_active(GTK_TOGGLE_BUTTON(insert_header_chkbtn), config->insert_header);
if (config->save_folder != NULL)
gtk_entry_set_text(GTK_ENTRY(save_spam_folder_entry), config->save_folder);
if (config->bogopath != NULL)
page->max_size = max_size_spinbtn;
page->process_emails = process_emails_checkbtn;
page->receive_spam = save_spam_checkbtn;
+ page->insert_header = insert_header_chkbtn;
page->save_folder = save_spam_folder_entry;
page->save_folder_select = save_spam_folder_select;
page->bogopath = bogopath_entry;
g_free(config->save_folder);
config->save_folder = gtk_editable_get_chars(GTK_EDITABLE(page->save_folder), 0, -1);
+ /* insert_header */
+ config->insert_header = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(page->insert_header));
+
/* bogopath */
g_free(config->bogopath);
config->bogopath = gtk_editable_get_chars(GTK_EDITABLE(page->bogopath), 0, -1);