diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-08-04 10:41:02 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-08-04 10:41:02 +0200 |
commit | b825f86108a91957f6467176e418cfc257874658 (patch) | |
tree | b46041bd2f06919b9702aa90cfaa20508c0c17e1 /program | |
parent | 7015dd99f90fb10f899d698f9601708f9a5f728b (diff) |
Move identity selection based on non-standard headers into (new) identity_select plugin (#1488553)
Diffstat (limited to 'program')
-rw-r--r-- | program/lib/Roundcube/rcube_storage.php | 2 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 24 |
2 files changed, 5 insertions, 21 deletions
diff --git a/program/lib/Roundcube/rcube_storage.php b/program/lib/Roundcube/rcube_storage.php index 4b336f210..de8334551 100644 --- a/program/lib/Roundcube/rcube_storage.php +++ b/program/lib/Roundcube/rcube_storage.php @@ -61,8 +61,6 @@ abstract class rcube_storage 'MAIL-FOLLOWUP-TO', 'MAIL-REPLY-TO', 'RETURN-PATH', - 'DELIVERED-TO', - 'ENVELOPE-TO', ); const UNKNOWN = 0; diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index cf3a791d8..e14d25ee3 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -1798,27 +1798,13 @@ function rcmail_identity_select($MESSAGE, $identities = null, $compose_mode = 'r } } - // Fallback using Delivered-To - if ($from_idx === null && ($delivered_to = $MESSAGE->headers->others['delivered-to'])) { - foreach ($identities as $idx => $ident) { - if (in_array($ident['email_ascii'], (array)$delivered_to)) { - $from_idx = $idx; - break; - } - } - } + // See identity_select plugin for example usage of this hook + $plugin = rcmail::get_instance()->plugins->exec_hook('identity_select', + array('message' => $MESSAGE, 'identities' => $identities, 'selected' => $from_idx)); - // Fallback using Envelope-To - if ($from_idx === null && ($envelope_to = $MESSAGE->headers->others['envelope-to'])) { - foreach ($identities as $idx => $ident) { - if (in_array($ident['email_ascii'], (array)$envelope_to)) { - $from_idx = $idx; - break; - } - } - } + $selected = $plugin['selected']; - return $identities[$from_idx !== null ? $from_idx : $default_identity]; + return $identities[$selected !== null ? $selected : $default_identity]; } // Fixes some content-type names |