From: Bernardo Freitas Paulo da Costa Date: Sat, 30 Oct 2010 23:12:31 +0000 (+0200) Subject: New action "imap_and_bounce" to simplify e-mail routing logic. X-Git-Tag: xorg/1.1.0~285 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=64fdccc7aae409ef542f2b57589cabd996dc5c6d;p=platal.git New action "imap_and_bounce" to simplify e-mail routing logic. Any modifications that would result in a situation like the one here searched for (that is, one user whose only active redirection is "imap") must have the action of his imap redirection changed to "imap_and_bounce". modified: 01_new_mail.sql new file: 02_imap_and_bounce.sql --- diff --git a/upgrade/1.1.0/01_new_mail.sql b/upgrade/1.1.0/01_new_mail.sql index aa181d5..9184947 100644 --- a/upgrade/1.1.0/01_new_mail.sql +++ b/upgrade/1.1.0/01_new_mail.sql @@ -40,6 +40,7 @@ CREATE TABLE email_redirect_account ( 'let_spams', 'tag_and_drop_spams', 'tag_spams', + 'imap_and_bounce', 'homonym') NOT NULL DEFAULT 'default', broken DATE NOT NULL DEFAULT '0000-00-00', @@ -61,6 +62,7 @@ CREATE TABLE email_redirect_other ( 'let_spams', 'tag_and_drop_spams', 'tag_spams', + 'imap_and_bounce', 'homonym') NOT NULL DEFAULT 'default', KEY (hrmid), diff --git a/upgrade/1.1.0/02_imap_and_bounce.sql b/upgrade/1.1.0/02_imap_and_bounce.sql new file mode 100644 index 0000000..f1391b1 --- /dev/null +++ b/upgrade/1.1.0/02_imap_and_bounce.sql @@ -0,0 +1,10 @@ +UPDATE email_redirect_account AS e, + (SELECT IF( SUM(IF(type!='imap',1,0))=0, 'imap_only', 'normal' ) AS status, uid + FROM email_redirect_account + WHERE flags = 'active' + GROUP BY uid) AS sub + SET e.action='imap_and_bounce' + WHERE sub.status='imap_only' + AND sub.uid = e.uid + AND type='imap'; +