help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnus Split Rules to SIEVE


From: Emanuel Berg
Subject: Re: gnus Split Rules to SIEVE
Date: Mon, 21 Sep 2015 00:20:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Ian Zimmerman <itz@buug.org> writes:

>> I've found a few threads pertaining to this, but
>> it's still unclear to me if there's a way to just
>> directly convert gnus split rules to SIEVE format?
>
> Not the answer you wanted, but it is very easy to
> write a Lisp program to do so.

Gnus splitting rules look like this:

    (setq nnmail-split-methods
     '(("spam-ooa"     "^X-Spam-Flag: YES\\|\\(^Subject: \\(lists.bofh.it 
mailing list memberships reminder\\|Happy Birthday From Facebook\\)\\)")
       ("zsh"          
"^\\(Cc\\|\\(Resent-\\)?To\\):.*zsh-\\(announce\\|workers\\|users\\)@zsh\.org.*")
       ("debian.user"  
"^\\(Cc\\|\\(Resent-\\)?To\\):.*debian-user@lists\.debian\.org.*")
       ("cc"           "^\\(Newsgroups: 
gnu.emacs.help\\)\\|\\(Cc\\|\\(Resent-\\)?To\\):.*\\(emacs-devel\\|help-gnu-emacs\\|info-gnus-english\\)@gnu\.org.*")
       ("spam-ooa"     
"^\\(Cc\\|\\(Resent-\\)?To\\):.*l4-hackers@os\.inf\.tu-dresden\.de.*")
       ("emacs-w3m"    "^Subject: \\(Re: \\)*\\[emacs-w3m.*")
       ("mail.misc"    "") ))

(By the way, the reason I have that piece of code is
I used it to get newsgroups out of mailing lists that
way, before I realized there was Gmane which does
exactly that, and much better - so I don't recommend
anyone doing it like that, tho what I remember it
worked mostly fine.)

Anyway, SIEVE, on the other hand, looks like this:

    # Reject mails from the hunting enthusiasts at example.com.
    if header :contains "list-id" "<duck-hunting.example.com>"
    {
        reject "No violence, please";
    }

    # The two test below are equivalent;
    # The first variant is clearer and probably also more efficient.
    if address :is :domain "to" "example.com"
    {
        fileinto "examplecom";
    }
    if address :matches :all "to" "*@example.com"
    {
        fileinto "examplecom";
    }

To write a Lisp program that translates from Gnus
splitting rules into the SIEVE syntax is a challenge
to any programmer. This isn't to say anyone should do
it. It will be a big effort for a small gain.

Why not just write the SIEVE and feel good about it?
Here is a tutorial, which is also where I found the
SIEVE syntax examples:

    https://www.tty1.net/blog/2011/sieve-tutorial_en.html

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

[Prev in Thread] Current Thread [Next in Thread]