summaryrefslogtreecommitdiff
path: root/program/steps/mail/func.inc
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2014-01-20 15:53:28 +0100
committerThomas Bruederli <thomas@roundcube.net>2014-01-20 15:53:28 +0100
commit19262e6eab19951393154d8e52fe141c63b5cd5d (patch)
tree7763901fd7135c7afd881b31c7dba02bebd740c1 /program/steps/mail/func.inc
parent1d6082c5e2ad4f12986c59fee49bec5bc68bd829 (diff)
Code cleanup: remove duplicated code, don't trigger multi-folder search on simple filter requests
Diffstat (limited to 'program/steps/mail/func.inc')
-rw-r--r--program/steps/mail/func.inc24
1 files changed, 21 insertions, 3 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index fd321e294..3487ec73f 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -363,7 +363,7 @@ function rcmail_message_list($attrib)
/**
* return javascript commands to add rows to the message list
*/
-function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null)
+function rcmail_js_message_list($a_headers, $insert_top=false, $a_show_cols=null)
{
global $RCMAIL, $OUTPUT;
@@ -382,6 +382,14 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null
$head_replace = true;
}
+ // add 'folder' column to list on multi-folder searches
+ $search_set = $RCMAIL->storage->get_search_set();
+ $multifolder = $search_set && $search_set[1]->multi;
+ if ($multifolder && !in_array('folder', $a_show_cols)) {
+ $a_show_cols[] = 'folder';
+ $head_replace = true;
+ }
+
$mbox = $RCMAIL->storage->get_folder();
// make sure 'threads' and 'subject' columns are present
@@ -390,8 +398,6 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null
if (!in_array('threads', $a_show_cols))
array_unshift($a_show_cols, 'threads');
- $_SESSION['list_attrib']['columns'] = $a_show_cols;
-
// Make sure there are no duplicated columns (#1486999)
$a_show_cols = array_unique($a_show_cols);
@@ -412,6 +418,10 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null
$OUTPUT->command('set_message_coltypes', $a_show_cols, $thead, $smart_col);
+ if ($multifolder) {
+ $OUTPUT->command('select_folder', '');
+ }
+
if (empty($a_headers)) {
return;
}
@@ -428,6 +438,14 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null
if (empty($header))
continue;
+ // make message UIDs unique by appending the folder name
+ if ($multifolder) {
+ $header->uid .= '-'.$header->folder;
+ $header->flags['skip_mbox_check'] = true;
+ if ($header->parent_uid)
+ $header->parent_uid .= '-'.$header->folder;
+ }
+
$a_msg_cols = array();
$a_msg_flags = array();