Timo Sirainen tss@iki.fi wrote:
On 25.9.2013, at 3.06, Charles Cazabon charlesc-dovecot@pyropus.ca wrote:
I hacked an additional %variable (I used %q) into a copy of mail-user.c:mail_user_var_expand_table ()
[...] Better to not give a one character name, but only the long name so it won't conflict with any future Dovecot additions.
That was my plan. I added the single character key when I was trying to debug why it wasn't working.
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. [...] It looks like this should be correct. The plugin settings expansion i done by mail-user.c:mail_user_expand_plugins_envs().
Aha, thanks. My code to set this information was still not being called quite early enough, so the table didn't contain a value for my variable when mail_user_expand_plugins_envs() was called.
I've rejigged it some more, and now it is indeed working. Thanks very much for your help with this.
The other possibility would be that you just modify mail-filter plugin and add the extra parameter without any %variable changes. Probably better since then you don't need to patch Dovecot core itself.
Ah, perhaps that wasn't clear - this isn't a constant or anything like that. The extra argument getting passed to mail_filter is taken from data the client sends to the IMAP server -- so I needed to be able to pull it out of the IMAP session and pass it to the mail_filter script.