diff options
author | Aleksander Machniak <alec@alec.pl> | 2012-08-27 11:19:05 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2012-08-27 11:20:54 +0200 |
commit | e2426ebc3f9f0e7ba5478ecdaa9afd6e2c829fe8 (patch) | |
tree | fda92d80f9354b1b75ac69a4cb5874547e00dc32 | |
parent | 5f23e8852a3510f48220cb3ba8d770a1d36641f9 (diff) |
Fix identity selection on reply (#1488101)
Conflicts:
CHANGELOG
-rw-r--r-- | CHANGELOG | 5 | ||||
-rw-r--r-- | program/steps/mail/compose.inc | 28 |
2 files changed, 15 insertions, 18 deletions
@@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Fix identity selection on reply (#1488101) - Fix Larry's messages list filter in IE (#1488632) - Fix more IE issues by disabling Compat. mode with X-UA-Compatible meta tag (#1488626) - Fix setting locales under Solaris - use additional .UTF-8 suffix (#1488628) @@ -1390,7 +1391,3 @@ RELEASE 0.1-RC1 Now based on the message structure delivered by the IMAP server. - Fixed some XSS and SQL injection issues - Fixed charset problems with folder renaming - - - - diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 713c1d847..a275394fd 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -298,16 +298,12 @@ else if (count($MESSAGE->identities)) { } $from_idx = null; - $default_identity = null; + $found_idx = null; + $default_identity = 0; // default identity is always first on the list $return_path = $MESSAGE->headers->others['return-path']; // Select identity foreach ($MESSAGE->identities as $idx => $ident) { - // save default identity ID - if ($ident['standard']) { - $default_identity = $idx; - } - // use From header if (in_array($compose_mode, array(RCUBE_COMPOSE_DRAFT, RCUBE_COMPOSE_EDIT))) { if ($MESSAGE->headers->from == $ident['ident']) { @@ -322,13 +318,22 @@ else if (count($MESSAGE->identities)) { } // use replied message recipients else if (($found = array_search($ident['email_ascii'], $a_recipients)) !== false) { - // match identity name, prefer default identity - if ($from_idx === null || ($a_names[$found] && $ident['name'] && $a_names[$found] == $ident['name'])) { + if ($found_idx === null) { + $found_idx = $idx; + } + // match identity name + if ($a_names[$found] && $ident['name'] && $a_names[$found] == $ident['name']) { $from_idx = $idx; + break; } } } + // If matching by name+address doesn't found any amtches, get first found address (identity) + if ($from_idx === null) { + $from_idx = $found_idx; + } + // Fallback using Return-Path if ($from_idx === null && $return_path) { foreach ($MESSAGE->identities as $idx => $ident) { @@ -339,12 +344,7 @@ else if (count($MESSAGE->identities)) { } } - // Still no ID, use default/first identity - if ($from_idx === null) { - $from_idx = $default_identity !== null ? $default_identity : key(reset($MESSAGE->identities)); - } - - $ident = $MESSAGE->identities[$from_idx]; + $ident = $MESSAGE->identities[$from_idx !== null ? $from_idx : $default_identity]; $from_id = $ident['identity_id']; $MESSAGE->compose['from_email'] = $ident['email']; |