Skip to content

Commit 6e954e1

Browse files
committed
fix for To/From formatting in IMAP message lists
1 parent c06f6c7 commit 6e954e1

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

modules/imap/modules.php

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,15 +2283,17 @@ function format_imap_message_list($msg_list, $output_module, $parent_list=false,
22832283
$subject = $msg['subject'];
22842284
if ($parent_list == 'sent') {
22852285
$icon = 'sent';
2286-
$from = preg_replace("/(\<.+\>)/U", '', $msg['to']);
2286+
$from = $msg['to'];
22872287
}
22882288
else {
2289-
$from = preg_replace("/(\<.+\>)/U", '', $msg['from']);
2289+
$from = $msg['from'];
22902290
}
2291-
$from = str_replace('"', '', $from);
2291+
$tmp_from = str_replace('"', '', $from);
2292+
$tmp_from = preg_replace("/(\<.+\>)/U", '', $tmp_from);
22922293
$nofrom = '';
2293-
if (!trim($from) && trim($msg['from'])) {
2294-
$from = $msg['from'];
2294+
2295+
if (trim($tmp_from)) {
2296+
$from = $tmp_from;
22952297
}
22962298
elseif (!trim($from) && $style == 'email') {
22972299
$from = '[No From]';
@@ -2308,19 +2310,13 @@ function format_imap_message_list($msg_list, $output_module, $parent_list=false,
23082310
}
23092311
}
23102312
if (trim($msg['x_auto_bcc']) === 'cypht') {
2313+
$from = preg_replace("/(\<.+\>)/U", '', $msg['to']);
23112314
$icon = 'sent';
23122315
}
2313-
if (stristr($msg['flags'], 'attachment')) {
2314-
$flags[] = 'attachment';
2315-
}
2316-
if (stristr($msg['flags'], 'deleted')) {
2317-
$flags[] = 'deleted';
2318-
}
2319-
if (stristr($msg['flags'], 'flagged')) {
2320-
$flags[] = 'flagged';
2321-
}
2322-
if (stristr($msg['flags'], 'answered')) {
2323-
$flags[] = 'answered';
2316+
foreach (array('attachment', 'deleted', 'flagged', 'answered') as $flag) {
2317+
if (stristr($msg['flags'], $flag)) {
2318+
$flags[] = $flag;
2319+
}
23242320
}
23252321
$source = $msg['server_name'];
23262322
$row_class .= ' '.str_replace(' ', '_', $source);

0 commit comments

Comments
 (0)