[prev in list] [next in list] [prev in thread] [next in thread] 

List:       listar-dev
Subject:    [LDev] [PATCH] scan message body for spam
From:       Rik van Riel <riel () conectiva ! com ! br>
Date:       2001-11-03 5:17:25
[Download RAW message or body]


Hi,

the attached patch makes Listar's antispam module optionally check
the body of the message for antispam regexps too.

Note that the default behaviour should still be the same as before,
this extra spam check is only enabled when the user switches it on
in the configuration file.  It'd be cool if this thing could be
included in the next Listar/encartis release ;)

It was made against listar-0.129a, but I guess it still applies
to the current antispam module ...

regards,

Rik
-- 
DMCA, SSSCA, W3C?  Who cares?  http://thefreeworld.net/

http://www.surriel.com/		http://distro.conectiva.com/


--- ./antispam.c.body	Sat Nov  3 02:52:38 2001
+++ ./antispam.c	Sat Nov  3 03:03:43 2001
@@ -61,9 +61,13 @@

    done = 0; matched = 0;

-   /* Read headers... */
+   /* Read message... */
    while(LMAPI->read_file(buffer,BIG_BUF,infile) && !done) {
-      if(buffer[0] == '\n') done = 1;
+
+      /* If we don't need to check the message body, stop after the header. */
+      if((buffer[0] == '\n') && !(LMAPI->get_bool("antispam-checkbody")))
+	 done = 1;
+
       if (!done) {
          buffer[strlen(buffer) - 1] = 0;
          LMAPI->rewind_file(regfile);
@@ -147,6 +151,9 @@
    LMAPI->register_var("spamfile", "spam-regexp", "AntiSpam",
                        "The file on disk which contains the regular expressions used \
to detect if a given sender is a spammer.",  "spamfile = spam-regexp", VAR_STRING, \
VAR_ALL); +   LMAPI->register_var("antispam-checkbody", "no", "AntiSpam",
+		       "Should the antispam module also check the message body.",
+		       "antispam-checkbody = no", VAR_BOOL, VAR_ALL);
 }

 void antispam_switch_context(void)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic