Then put mail_plugins setting outside protocol {}.
It looks like the mail_plugins setting outside protocol has no effect. .. These are the settings from the protocol imap section. Oh, right. That's because of how it's implemented in v1.2. Kind of ugly, but I don't know if I'll bother fixing it until it becomes a real problem for someone. :) v2.0 implements this properly.
Sure, the current implementation works for me. Thanks again Timo!
Spoke too soon ;-)
Adding imap_quota plugin to the mail_plugins for protocol imap breaks it:
$ sudo /usr/sbin/dovecot --exec-mail ext /opt/bin/expire-tool.sh --test Info: Loading modules from directory: /usr/lib/dovecot/modules/imap Info: Module loaded: /usr/lib/dovecot/modules/imap/lib10_quota_plugin.so Error: dlopen(/usr/lib/dovecot/modules/imap/lib11_imap_quota_plugin.so) failed: /usr/lib/dovecot/modules/imap/lib11_imap_quota_plugin.so: undefined symbol: capability_string Fatal: Couldn't load required plugins