I needed the ability to turn on and off a global sieve script depending on a user's option for spam sorting. I have attached the files diffed against release 2.3.3 since the trunk was too different from my live version.
The following was added to the SQL script in Dovecot for the user_query:
IF(spam=1, '/var/vmail/sieve/spam.sieve','') as sieve \
And the following was altered on the table mailbox:
alter table mailbox add column spam tinyint(1) not null default 1 after quota;
The original intent was to have the sieve script name changeable or at least selected from the database (stored per user or in a different table joined in) but I was against the clock and didn't get that join code in place.
This just places a check box on the mailbox create and modify pages enabling and disabling according to their preference. Global option to allow this is in the configuration file, and the default user option to pre-fill forms is as well.