diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2014-04-23 13:21:51 +0200 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2014-04-23 13:21:51 +0200 |
commit | 31aa080609f6ea8a561182eb5b3da46733bef313 (patch) | |
tree | 24ef1d723fdfaaf9ccc3a709fa2df7b3b4183bd4 /program/steps | |
parent | 3b55b2f92b435630f56e63f5796471abacaaf425 (diff) |
Further refine cross-folder searching:
- Store incomplete search results in session and re-send search requests
to the server if returned before complete (this should avoid hitting request timeouts).
- Display full folder path on mouseover in message list
- Remove pthreads implementation stuff as this wasn't really working
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/mail/func.inc | 2 | ||||
-rw-r--r-- | program/steps/mail/search.inc | 26 |
2 files changed, 22 insertions, 6 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 10d30a5f3..b9971ce0c 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -142,7 +142,7 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') { if (!$OUTPUT->ajax_call) { $OUTPUT->add_label('checkingmail', 'deletemessage', 'movemessagetotrash', 'movingmessage', 'copyingmessage', 'deletingmessage', 'markingmessage', - 'copy', 'move', 'quota', 'replyall', 'replylist'); + 'copy', 'move', 'quota', 'replyall', 'replylist', 'stillsearching'); } $pagetitle = $RCMAIL->localize_foldername($mbox_name, true); diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc index 813e8c492..f52d1a084 100644 --- a/program/steps/mail/search.inc +++ b/program/steps/mail/search.inc @@ -38,6 +38,7 @@ $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_GET, true); $filter = rcube_utils::get_input_value('_filter', rcube_utils::INPUT_GET); $headers = rcube_utils::get_input_value('_headers', rcube_utils::INPUT_GET); $scope = rcube_utils::get_input_value('_scope', rcube_utils::INPUT_GET); +$continue = rcube_utils::get_input_value('_continue', rcube_utils::INPUT_GET); $subject = array(); $filter = trim($filter); @@ -110,6 +111,12 @@ if (!empty($subject)) { $search_str = trim($search_str); $sort_column = rcmail_sort_column(); +// set message set for already stored (but incomplete) search request +if (!empty($continue) && isset($_SESSION['search']) && $_SESSION['search_request'] == $continue) { + $RCMAIL->storage->set_search_set($_SESSION['search']); + $search_str = $_SESSION['search'][0]; +} + // execute IMAP search if ($search_str) { // search all, current or subfolders folders @@ -126,10 +133,6 @@ if ($search_str) { $result = $RCMAIL->storage->search($mboxes, $search_str, $imap_charset, $sort_column); } -// Get the headers -$result_h = $RCMAIL->storage->list_messages($mbox, 1, $sort_column, rcmail_sort_order()); -$count = $RCMAIL->storage->count($mbox, $RCMAIL->storage->get_threading() ? 'THREADS' : 'ALL'); - // save search results in session if (!is_array($_SESSION['search'])) { $_SESSION['search'] = array(); @@ -142,6 +145,13 @@ if ($search_str) { $_SESSION['search_request'] = $search_request; $_SESSION['search_scope'] = $scope; + +// Get the headers +if (!$result->incomplete) { + $result_h = $RCMAIL->storage->list_messages($mbox, 1, $sort_column, rcmail_sort_order()); + $count = $RCMAIL->storage->count($mbox, $RCMAIL->storage->get_threading() ? 'THREADS' : 'ALL'); +} + // Make sure we got the headers if (!empty($result_h)) { rcmail_js_message_list($result_h, false); @@ -157,9 +167,15 @@ if (!empty($result_h)) { } } // handle IMAP errors (e.g. #1486905) -else if ($err_code = $RCMAIL->storage->get_error_code()) { +else if ($err_code = $RCMAIL->storage->get_error_code()) { $RCMAIL->display_server_error(); } +// advice the client to re-send the (cross-folder) search request +else if ($result->incomplete) { + $count = 0; // keep UI locked + $OUTPUT->command('continue_search', $search_request); + console('search incomplete', strlen(serialize($result))); +} else { $OUTPUT->show_message('searchnomatch', 'notice'); $OUTPUT->set_env('multifolder_listing', (bool)$result->multi); |