Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Julien Cubizolles <j.cubizolles@free.fr>
To: info-gnus-english@gnu.org
Subject: Re: Fancy splitting and spam detection
Date: Wed, 26 Aug 2015 22:58:31 +0200	[thread overview]
Message-ID: <87lhcx3gy0.fsf@free.fr> (raw)
In-Reply-To: <87vbcal896.fsf@free.fr>

Julien Cubizolles <j.cubizolles@free.fr> writes:

> I'm trying to setup fancy splitting on an imap server and I can't get
> spam-split to work:

> (setq gnus-ignored-from-addresses (regexp-opt '("j.cubizolles@free.fr" "j.cubizolles@gmail.com")))
>
> (spam-initialize 'spam-use-move)
>
> (setq spam-use-bogofilter t)
>
> (require 'spam)
>
> (setq spam-mark-ham-unread-before-move-from-spam-group t)
> (setq spam-mark-only-unseen-as-spam t)
>
> (setq spam-split-group "Junk") ;unqualified group name
>
> (setq nnmail-split-methods 'nnmail-split-fancy)
>
> (setq nnmail-split-fancy
>       `(|
> 	("from" ,gnus-ignored-from-addresses "sent-mail")
> 	(: (lambda ()
> 		(car (bbdb/gnus-split-method))))
> 	("gnus-warning" "duplicat\\(e\\|ion\\) of message" "duplicate")
> 	;; all the rest
> 	"General"
> 	))
>
> (setq nnimap-split-fancy
>       `(|
> 	("from" ,gnus-ignored-from-addresses "sent-mail")
> 	(: (lambda ()
> 		(car (bbdb/gnus-split-method))))
> 	("gnus-warning" "duplicat\\(e\\|ion\\) of message" "duplicate")
> 	(: spam-split 'spam-use-bogofilter)
> 	;; all the rest
> 	"General"
> 	))
>
> (setq gnus-secondary-select-methods
>       '(
> 	(nnimap "gmail"
>                 (nnimap-address "imap.gmail.com")
>                 (nnimap-stream ssl)
> 		(nnir-search-engine imap)
> 		(nnimap-split-methods 'nnimap-split-fancy)
> 		(nnimap-inbox "INBOX"))
> 	(nnimap "free"
> 		(nnimap-address "imap.free.fr")
> 		(nnir-search-engine imap)
> 		(nnimap-split-methods 'nnimap-split-fancy)
> 		(nnimap-inbox "INBOX")
> 		)
> 	)
> )

For some reason, the following works, no idea why though. I basically
changed the order in which variables are defined, and use the default
value for nnimap-split-methods, with the fancy splitting set by
nnmail-split-fancy instead of nnimap-split-fancy.

--8<---------------cut here---------------start------------->8---
(setq gnus-ignored-from-addresses (regexp-opt '("j.cubizolles@free.fr" "j.cubizolles@gmail.com")))

(setq bbdb/gnus-split-nomatch-function nil
      bbdb/gnus-split-default-group nil
      bbdb/gnus-split-myaddr-regexp gnus-ignored-from-addresses
      )

(require 'spam)
(spam-initialize 'spam-use-move)
(setq spam-use-bogofilter t)

(setq spam-mark-ham-unread-before-move-from-spam-group t)
(setq spam-mark-only-unseen-as-spam t)

(setq spam-split-group "Junk") ;unqualified group name

(setq gnus-secondary-select-methods
      '(
	(nnimap "gmail"
                (nnimap-address "imap.gmail.com")
                (nnimap-stream ssl)
		(nnir-search-engine imap)
		(nnimap-inbox "INBOX")
		(nnimap-split-methods default)
		)
	(nnimap "free"
		(nnimap-address "imap.free.fr")
		(nnir-search-engine imap)
		(nnimap-inbox "INBOX")
		(nnimap-split-methods default)
		)
	(nntp "news.gwene.org"
	      (nnir-search-engine gmane))
	(nntp "news.gmane.org"
	      (nnir-search-engine gmane))
	)
)

(setq nnmail-split-fancy
      '(|
	;; ("from" ,gnus-ignored-from-addresses "sent-mail")
	(: (lambda ()
		(car (bbdb/gnus-split-method))))
	(: spam-split 'spam-use-bogofilter)
	("gnus-warning" "duplicat\\(e\\|ion\\) of message" "duplicate")
	;; all the rest
	"General"
	))

--8<---------------cut here---------------end--------------->8---

Julien.



      parent reply	other threads:[~2015-08-26 20:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-20  7:38 Julien Cubizolles
2015-08-21 19:15 ` Emanuel Berg
2015-08-24 11:41   ` Julien Cubizolles
2015-08-24 19:30     ` Emanuel Berg
2015-08-26 20:58 ` Julien Cubizolles [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lhcx3gy0.fsf@free.fr \
    --to=j.cubizolles@free.fr \
    --cc=info-gnus-english@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).