Changeset 4436b43 in github
- Timestamp:
- Aug 19, 2011 6:07:41 AM (22 months ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.7, release-0.8
- Children:
- 8015bb94
- Parents:
- dd6a47c
- Files:
-
- 2 edited
-
CHANGELOG (modified) (1 diff)
-
program/steps/mail/compose.inc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
r5c9d1ff r4436b43 2 2 =========================== 3 3 4 - Fixed selecting identity on reply/forward (#1487981) 4 5 - Add option to hide selected LDAP addressbook on the list 5 6 - Add client-side checking of uploaded files size -
program/steps/mail/compose.inc
rfe0cb65 r4436b43 226 226 if (count($MESSAGE->identities)) 227 227 { 228 foreach ($MESSAGE->identities as $idx => $sql_arr) { 229 $email = mb_strtolower(rcube_idn_to_utf8($sql_arr['email'])); 230 $MESSAGE->identities[$idx]['email_ascii'] = $sql_arr['email']; 228 foreach ($MESSAGE->identities as $idx => $ident) { 229 $email = mb_strtolower(rcube_idn_to_utf8($ident['email'])); 230 231 $MESSAGE->identities[$idx]['email_ascii'] = $ident['email']; 232 $MESSAGE->identities[$idx]['ident'] = format_email_recipient($ident['email'], $ident['name']); 231 233 $MESSAGE->identities[$idx]['email'] = $email; 232 234 } … … 243 245 // extract all recipients of the reply-message 244 246 $a_recipients = array(); 245 if ( $compose_mode == RCUBE_COMPOSE_REPLY && is_object($MESSAGE->headers))247 if (is_object($MESSAGE->headers) && in_array($compose_mode, array(RCUBE_COMPOSE_REPLY, RCUBE_COMPOSE_FORWARD))) 246 248 { 247 249 $a_to = $IMAP->decode_address_list($MESSAGE->headers->to); … … 261 263 262 264 $from_idx = null; 263 $default_identity = 0;265 $default_identity = null; 264 266 $return_path = $MESSAGE->headers->others['return-path']; 265 267 266 268 // Select identity 267 foreach ($MESSAGE->identities as $idx => $ sql_arr) {269 foreach ($MESSAGE->identities as $idx => $ident) { 268 270 // save default identity ID 269 if ($ sql_arr['standard']) {271 if ($ident['standard']) { 270 272 $default_identity = $idx; 271 273 } 272 // we need ascii here 273 $email = $sql_arr['email_ascii']; 274 $ident = format_email_recipient($email, $sql_arr['name']); 275 276 // select identity 277 if (in_array($compose_mode, array(RCUBE_COMPOSE_DRAFT, RCUBE_COMPOSE_EDIT, RCUBE_COMPOSE_REPLY))) { 278 if ($MESSAGE->headers->from == $ident) { 274 275 // use From header 276 if (in_array($compose_mode, array(RCUBE_COMPOSE_DRAFT, RCUBE_COMPOSE_EDIT))) { 277 if ($MESSAGE->headers->from == $ident['email_ascii']) { 279 278 $from_idx = $idx; 280 279 break; 281 280 } 282 281 } 283 // set identity if it's one of the reply-message recipients 284 else if (in_array($email, $a_recipients) && ($from_idx === null || $sql_arr['standard'])) { 282 else if ($compose_mode == RCUBE_COMPOSE_REPLY && $MESSAGE->headers->from == $ident['email_ascii']) { 285 283 $from_idx = $idx; 286 } 287 // set identity when replying to mailing list 288 else if (strpos($return_path, str_replace('@', '=', $email).'@') !== false) { 284 break; 285 } 286 // use reply-message recipients 287 else if (in_array($ident['email_ascii'], $a_recipients)) { 289 288 $from_idx = $idx; 290 289 } 291 290 } 292 291 293 // Still no ID, use first identity 292 // Fallback using Return-Path 293 if ($from_idx === null && $return_path) { 294 foreach ($MESSAGE->identities as $idx => $ident) { 295 if (strpos($return_path, str_replace('@', '=', $ident['email_ascii']).'@') !== false) { 296 $from_idx = $idx; 297 break; 298 } 299 } 300 } 301 302 // Still no ID, use default/first identity 294 303 if ($from_idx === null) { 295 $from_idx = $default_identity ;304 $from_idx = $default_identity !== null ? $default_identity : key(reset($MESSAGE->identities)); 296 305 } 297 306
Note: See TracChangeset
for help on using the changeset viewer.
