[Dovecot] "pipe" plugin - is anyone interested (or using it)?

Johannes Berg johannes at sipsolutions.net
Fri Dec 7 17:50:04 EET 2007


> > plugin {
> > (...)
> >   pipe = /var/learn/%u/.spam:spamc -d some.host -L spam
> >   pipe2 = /var/learn/%u/.ham:spamc -d some.host -L ham
> > (...)
> 
> And here I define that any message stored to /var/learn/%u/.spam where
> %u is the username (that is learn.spam in the user's IMAP namespace) has
> to be piped to the "spamc -d some.host -L spam" command. And the same
> for ham.

The above is why I like my antispam plugin much better: you can push
into *any* folder *from* spam to train as ham.

I do think, however, that the two plugins could possibly converge. That
would entail being able to specify pipes with two endpoints, right now
you just have the destination folder. In order to do that, the plugin
would have to be configurable like this, with the pipes tried in the
order they are numbered:

# learn into spam as spam
pipe.1 = *>SPAM		|/learn/as --spam
pipe.2 = UNSURE>SPAM	|/learn/as --spam
# forbid into unsure
pipe.3 = *>UNSURE	-
# learn from unsure or spam folder as ham
pipe.4 = UNSURE>*	|/learn/as --ham
pipe.5 = SPAM>*		|/learn/as --ham

Maybe for the configuration some "command aliases" could be defined:

pipe.cmd.learnas = /learn/as --user %u
pipe.1 = *>SPAM		!learnas --spam

causes an internal expansion to:
pipe.1 = *>SPAM		|/learn/as --user %u --spam


As you can see, I have prefixed the "command" with a pipe symbol. This
indicates that a program shall be invoked. I have prefixed the alias
with an exclamation mark. In order to have the libdspam (or similar)
training some people wanted, we could allow a bare specification for
ld-open style:
pipe.1 = *>SPAM		builtin_learn_as

which would essentially do:
fn = dlsym(RTLD_DEFAULT, "builtin_learn_as");
fn(source folder, dest folder, mail struct[, ...?])

This would allow writing a simple plugin, having dovecot load it (before
the pipe plugin) and having a function in that plugin called, splitting
the work the antispam plugin would do in that case into two plugins.

I guess that such a plugin is actually more generic than "pipe" then.

Do you have the pipe plugin code in git anywhere I can pull from and see
if I can do such modifications?

johannes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 828 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20071207/938d3a35/attachment.bin 


More information about the dovecot mailing list