/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 Colin Leroy <colin@colino.net> and
+ * Copyright (C) 1999-2012 Colin Leroy <colin@colino.net> and
* the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
#ifdef HAVE_CONFIG_H
# include "config.h"
+#include "claws-features.h"
#endif
#include "defs.h"
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
+#ifdef USE_PTHREAD
+#include <pthread.h>
+#endif
#define PLUGIN_NAME (_("Bogofilter"))
int status = 0;
MsgInfo *msginfo;
GSList *cur = NULL;
- int total = 0, curnum = 0;
+ int total = 0, curnum = 1;
gchar *file = NULL;
gchar buf[BUFSIZ];
gchar *ab_folderpath;
if (*config.whitelist_ab_folder == '\0' ||
- strcasecmp(config.whitelist_ab_folder, _("Any")) == 0) {
+ strcasecmp(config.whitelist_ab_folder, "Any") == 0) {
/* match the whole addressbook */
ab_folderpath = NULL;
} else {
data->new_hams = g_slist_prepend(data->new_hams, msginfo);
} else {
gchar **parts = NULL;
+
+ buf[sizeof(buf) - 1] = '\0';
if (strchr(buf, '/')) {
tmp = strrchr(buf, '/')+1;
} else {
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");
+ FILE *input = g_fopen(file, "r");
+ FILE *output = g_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 {
+ else if (input && output) {
gchar tmpbuf[BUFFSIZE];
gboolean err = FALSE;
const gchar *bogosity = *parts[1] == 'S' ? "Spam":
(*parts[1] == 'H' ? "Ham":"Unsure");
gchar *tmpstr = g_strdup_printf(
- "X-Claws-Bogosity: %s, spamicity=%s%s\n",
+ "X-Bogosity: %s, spamicity=%s%s\n",
bogosity, parts[2],
whitelisted?" [whitelisted]":"");
if (fwrite(tmpstr, 1, strlen(tmpstr), output) < strlen(tmpstr)) {
gchar *file = NULL;
const gchar *bogo_exec = (config.bogopath && *config.bogopath) ? config.bogopath:"bogofilter";
gint status = 0;
+
if (msginfo == NULL && msglist == NULL) {
return -1;
}
g_free(file);
if (message_callback != NULL)
message_callback(NULL, 0, 0, FALSE);
- return 0;
}
- }
- if (msglist) {
+ } else if (msglist) {
GSList *cur = msglist;
MsgInfo *info;
int total = g_slist_length(msglist);
if (message_callback != NULL)
message_callback(NULL, 0, 0, FALSE);
- return 0;
}
- return -1;
+ return 0;
}
void bogofilter_save_config(void)