Index: roundcubemail/program/steps/mail/check_recent.inc =================================================================== --- roundcubemail/program/steps/mail/check_recent.inc (revision 2308) +++ roundcubemail/program/steps/mail/check_recent.inc (working copy) @@ -25,12 +25,13 @@ foreach ($a_mailboxes as $mbox_name) { if ($mbox_name == $IMAP->get_mailbox_name()) { if ($recent_count = $IMAP->messagecount(NULL, 'RECENT', TRUE)) { + $message_threading = rcmail::get_instance()->config->get('message_threading',false); // refresh saved search set if (($search_request = get_input_value('_search', RCUBE_INPUT_GPC)) && isset($_SESSION['search'][$search_request])) { $_SESSION['search'][$search_request] = $IMAP->refresh_search(); - $all_count = $IMAP->messagecount(); + $all_count = $IMAP->messagecount(NULL, $message_threading?'THREADS':'ALL'); } else { - $all_count = $IMAP->messagecount(NULL, 'ALL', TRUE); + $all_count = $IMAP->messagecount(NULL, $message_threading?'THREADS':'ALL', TRUE); } $unread_count = $IMAP->messagecount(NULL, 'UNSEEN', TRUE); @@ -51,18 +52,24 @@ if (empty($_GET['_list'])) continue; - // use SEARCH/SORT to find recent messages - $search_str = 'RECENT'; - if ($search_request) - $search_str .= ' '.$IMAP->search_string; + if ($message_threading) { + $OUTPUT->command('message_list.clear'); + $sort_col = isset($_SESSION['sort_col']) ? $_SESSION['sort_col'] : $CONFIG['message_sort_col']; + $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order']; + $result_h = $IMAP->list_headers($mbox_name, NULL, $sort_col, $sort_order); + // add to the list + rcmail_js_message_list($result_h); + } else { + // use SEARCH/SORT to find recent messages + $search_str = 'RECENT'; + if ($search_request) + $search_str .= ' '.$IMAP->search_string; - $result = $IMAP->search($mbox_name, $search_str, NULL, 'date'); - - if ($result) { - // get the headers - $result_h = $IMAP->list_headers($mbox_name, 1, 'date', 'DESC'); - // add to the list - rcmail_js_message_list($result_h, TRUE); + $result = $IMAP->search($mbox_name, $search_str, NULL, 'date'); + // get the headers + $result_h = $IMAP->list_headers($mbox_name, 1, 'date', 'DESC'); + // add to the list + rcmail_js_message_list($result_h, TRUE); } } }