[Dovecot] Passing info from mail process to mail_filter plugin script?
Charles Cazabon
charlesc-dovecot at pyropus.ca
Wed Sep 25 03:06:04 EEST 2013
Timo Sirainen <tss at iki.fi> wrote:
>
> Without modifications the only way to pass data is via the plugin {
> mail_filter } parameters, such as the %u expanding to username in the
> example.
I hacked an additional %variable (I used %q) into a copy of
mail-user.c:mail_user_var_expand_table () (and called this modified version
instead of the original, in the same place it is normally called), and moved
my data collection around in imap/main.c:settings_var_expand() so that my info
was available at the time mail_user->var_expand_table is populated.
This appears to be working thus far. If I iterate over that table, my custom
variable is present and has a correct key, value, and long_key before
client_create() is called.
But when I put %q into the mail_filter config like so:
mail_plugins = $mail_plugins mail_filter
plugin {
mail_filter = mail-filter %q foo %u
mail_filter_out = mail-filter-out %u
}
... and restart Dovecot, I find that the filter script is only being passed 2
arguments, the constant "foo" in the above and the username. The %q does not
appear to be getting replaced; it's just skipped over. It's not even passing
an empty string in its place.
Am I modifying the correct var_expand_table here? Is there any step I've
missed in making the new variable get substituted properly? lib/var-expand.c
doesn't appear to require anything else, but I may have missed something...
Any help appreciated,
Charles
--
-----------------------------------------------------------------------
Charles Cazabon
GPL'ed software available at: http://pyropus.ca/software/
-----------------------------------------------------------------------
More information about the dovecot
mailing list