From 64fdccc7aae409ef542f2b57589cabd996dc5c6d Mon Sep 17 00:00:00 2001 From: Bernardo Freitas Paulo da Costa Date: Sun, 31 Oct 2010 01:12:31 +0200 Subject: [PATCH] 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 --- upgrade/1.1.0/01_new_mail.sql | 2 ++ upgrade/1.1.0/02_imap_and_bounce.sql | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 upgrade/1.1.0/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'; + -- 2.1.4