Browse Source

Add crm114 related stuff

Emmanuel Bouthenot 16 years ago
parent
commit
471074b218
3 changed files with 33 additions and 6 deletions
  1. 4 1
      .madmutt/cfg.lua
  2. 5 2
      .madmutt/macros
  3. 24 3
      .mailfilter

+ 4 - 1
.madmutt/cfg.lua

@@ -18,7 +18,7 @@ mod_core.tmpdir = mod_core.homedir..'/.madmutt/tmp'
 local maildir = "/home/manu/Mail/imap/"
 local mailboxes = { maildir }
 
-mod_buffy.mail_check = 5
+mod_buffy.mail_check = 2
 
 MAlias.record = maildir..'/.Sent'
 MAlias.alias_file = "~/.madmutt/aliases"
@@ -70,6 +70,7 @@ local mailboxes_pattern = {
    ".sys.sympa",
    ".sys.reports",
    ".sys.infos",
+   ".my.debian-nm",
    ".my.cnam",
    ".my.misc",
    ".friends.tbs.tiacfooting",
@@ -151,6 +152,8 @@ local headers = {
    "Message-ID:",
    "X-Org-Mail:",
    "X-Org-Id:",
+   "X-CRM114-Score:",
+   "X-CRM114-Spam:",
 }
 iter(mod_mime.unignore, headers)
 iter(mod_mime.hdr_order, headers)

+ 5 - 2
.madmutt/macros

@@ -23,5 +23,8 @@ macro index,pager B	"<enter-command>toggle sidebar_visible<enter>"	"Toggle sideb
 macro index \cx "<tag-pattern>~N<enter><tag-prefix><toggle-new><tag-prefix><clear-flag>*" "Mark all new messages as read"
 
 # spamassassin macros
-macro index,pager \ch "<enter-command>unset wait_key<enter><pipe-message>sa-learn --forget<enter><pipe-message>sa-learn --ham --no-sync<enter><enter-command>set wait_key<enter>"	"Set message as HAM"
-macro index,pager \cs "<enter-command>unset wait_key<enter><bounce-message>spam@kaoru<enter><enter-command>set wait_key<enter><save-message>=.Spam<enter>" "Set message as SPAM"
+#macro index,pager \ch "<enter-command>unset wait_key<enter><pipe-message>sa-learn --forget<enter><pipe-message>sa-learn --ham --no-sync<enter><enter-command>set wait_key<enter>"	"Set message as HAM"
+#macro index,pager \cs "<enter-command>unset wait_key<enter><bounce-message>spam@kaoru<enter><enter-command>set wait_key<enter><save-message>=.Spam<enter>" "Set message as SPAM"
+
+macro index,pager \eh "<enter-command>unset wait_key<enter><pipe-message>crmlearn --learnnonspam<enter><enter-command>set wait_key<enter>" "Set message as HAM via CRM114"
+macro index,pager \es "<enter-command>unset wait_key<enter><pipe-message>crmlearn --learnspam<enter><enter-command>set wait_key<enter><save-message>=.Spam<enter>" "Set message as SPAM via CRM114"

+ 24 - 3
.mailfilter

@@ -1,6 +1,7 @@
 # .Mailfilter - rules for maildrop
 
-MAILDIR="/home/manu/Mail/imap"
+HOME="/home/manu"
+MAILDIR="$HOME/Mail/imap"
 MAILDIRMAKE="/usr/bin/maildirmake"
 VERBOSE=9
 
@@ -10,7 +11,7 @@ logfile "/home/manu/Admin/logs/maildrop/maildrop.log"
 
 
 ## Listes RMLL 2008
-if (/^To:.*organisation@rmll2008.org.*$/ || /^Cc:.*organisation@rmll2008.org.*$/ || /^X-BeenThere:.*2008@rmll.info.*$/)
+if (/^To:.*organisation@rmll2008\.org.*$/ || /^Cc:.*organisation@rmll2008\.org.*$/ || /^X-BeenThere:.*2008@rmll\.info.*$/)
 	to  $MAILDIR/.my.ml.rmll.2008
 
 #if (/^List-Id:.*![^ <]+!\.rmll\.info.*$/)
@@ -25,6 +26,10 @@ if (/^List-Id:.*communication\.rmll\.info.*$/)
 	to $MAILDIR/.my.ml.rmll.communication
 if (/^List-Id:.*partenaires\.rmll\.info.*$/)
 	to $MAILDIR/.my.ml.rmll.partenaires
+if (/^List-Id:.*participants\.rmll\.info.*$/)
+	to $MAILDIR/.my.ml.rmll.participants
+if (/^From:.*reservation@rmll\.info.*$/)
+	to $MAILDIR/.my.ml.rmll.resa
 
 
 ## Debian backports
@@ -98,7 +103,23 @@ if (/^Subject:.*[tT][iI][aA][cC].*[iI][nN][fF][oO]/)
 
 ### Spam
 
-xfilter "spamc"
+CRMSCORE=`grep -a -v "^X-CRM114" | crm -u $HOME/.crm/ /usr/share/crm114/mailfilter.crm --stats_only`
+xfilter "formail -I \"X-CRM114-Score: $CRMSCORE\""
+
+if ($CRMSCORE < -1)
+{
+    xfilter "formail -I \"X-CRM114-Spam: yes\""
+}
+
+log "Spam: $CRMSCORE"
+
+#if (/^X-CRM114-Spam: yes/)
+#{
+#    to $MAILDIR/.Spam
+#}
+
+
+#xfilter "spamc"
 if (/^X-Spam-Status: YES/)
 {
     to $MAILDIR/.Spam