static SpamAssassinConfig config;
static PrefParam param[] = {
+ {"enable", "FALSE", &config.enable, P_BOOL,
+ NULL, NULL, NULL},
{"transport", "0", &config.transport, P_INT,
NULL, NULL, NULL},
{"hostname", "localhost", &config.hostname, P_STRING,
struct message m;
gboolean is_spam = FALSE;
+ if (!config.enable)
+ return FALSE;
+
transport_init(&trans);
switch (config.transport) {
case SPAMASSASSIN_TRANSPORT_LOCALHOST:
int pid = 0;
int status;
- if (config.transport == SPAMASSASSIN_DISABLED) {
+ /* SPAMASSASSIN_DISABLED : keep test for compatibility purpose */
+ if (!config.enable || config.transport == SPAMASSASSIN_DISABLED) {
log_error("Spamassassin plugin is disabled by its preferences.\n");
return FALSE;
}
execute_command_line(tmpcmd, FALSE);
g_free(tmpcmd);
}
- if (tmpfile != NULL) {
- g_free(tmpfile);
- }
- }
- if (spamc_wrapper != NULL) {
- g_free(spamc_wrapper);
+ g_free(tmpfile);
}
+ g_free(spamc_wrapper);
return 0;
} else {
cmd = g_strdup_printf("sa-learn -u %s %s %s",
g_free(cmd);
cmd = tmpcmd;
}
- if (tmpfile != NULL) {
- g_free(tmpfile);
- }
+ g_free(tmpfile);
}
}
}
/* only run sync calls to sa-learn/spamc to prevent system lockdown */
execute_command_line(cmd, FALSE);
g_free(cmd);
- if (spamc_wrapper != NULL) {
- g_free(spamc_wrapper);
- }
+ g_free(spamc_wrapper);
+
return 0;
}
spamassassin_register_hook();
}
- if (config.transport == SPAMASSASSIN_DISABLED) {
+ if (!config.enable || config.transport == SPAMASSASSIN_DISABLED) {
log_error("Spamassassin plugin is loaded but disabled by its preferences.\n");
}
-
- if (config.transport != SPAMASSASSIN_DISABLED) {
+ else {
if (config.transport == SPAMASSASSIN_TRANSPORT_TCP)
debug_print("Enabling learner with a remote spamassassin server requires spamc/spamd 3.1.x\n");
procmsg_register_spam_learner(spamassassin_learn);
const gchar *plugin_desc(void)
{
- return _("This plugin checks all messages that are received from an "
+ return _("This plugin can check all messages that are received from an "
"IMAP, LOCAL or POP account for spam using a SpamAssassin "
"server. You will need a SpamAssassin Server (spamd) running "
"somewhere.\n"
"\n"
+ "It can also be used for marking messages as Ham or Spam.\n"
+ "\n"
"When a message is identified as spam it can be deleted or "
- "saved into a special folder.\n"
- "\n");
+ "saved in a specially designated folder.\n"
+ "\n"
+ "Options can be found in /Configuration/Preferences/Plugins/SpamAssassin");
}
const gchar *plugin_type(void)