diff options
author | thomascube <thomas@roundcube.net> | 2008-02-02 19:41:32 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2008-02-02 19:41:32 +0000 |
commit | df0da2e059ac7d12f5fbd4735a66736b2efdf61d (patch) | |
tree | c988b1a0496662eb2875a65ce015560064ff4bb0 /program | |
parent | 39508cb784394c3ba3e6bdce5e19ddace6210060 (diff) |
Simplified fix for remembering searches when viewing message + Don't ask for MDN confirmations on drafted messages (#1484691)
Diffstat (limited to 'program')
-rw-r--r-- | program/include/rcube_imap.inc | 12 | ||||
-rw-r--r-- | program/steps/mail/show.inc | 28 |
2 files changed, 13 insertions, 27 deletions
diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc index 091048a15..1f94adcd1 100644 --- a/program/include/rcube_imap.inc +++ b/program/include/rcube_imap.inc @@ -761,7 +761,17 @@ class rcube_imap $this->_set_sort_order($sort_field, $sort_order); $mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox; - $key = "$mbox:".$this->sort_field.":".$this->sort_order.".msgi"; + $key = "{$mailbox}:{$this->sort_field}:{$this->sort_order}:{$this->search_string}.msgi"; + + // we have a saved search result. get index from there + if (!isset($this->cache[$key]) && $this->search_string && $mailbox == $this->mailbox) + { + $this->cache[$key] = $a_msg_headers = array(); + $this->_fetch_headers($mailbox, join(',', $this->search_set), $a_msg_headers, NULL); + + foreach (iil_SortHeaders($a_msg_headers, $this->sort_field, $this->sort_order) as $i => $msg) + $this->cache[$key][] = $msg->uid; + } // have stored it in RAM if (isset($this->cache[$key])) diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index 9a94a9493..e6aa19270 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -74,24 +74,17 @@ if ($_GET['_uid']) $OUTPUT->set_env('safemode', intval($_GET['_safe'])); // check for unset disposition notification - if ($MESSAGE['headers']->mdn_to && !$MESSAGE['headers']->mdn_sent) + if ($MESSAGE['headers']->mdn_to && !$MESSAGE['headers']->mdn_sent && $IMAP->get_mailbox_name() != $CONFIG['drafts_mbox']) { rcube_add_label('mdnrequest'); $OUTPUT->set_env('mdn_request', true); } - // set message set for search result - if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search']])) - { - $IMAP->set_search_set($_SESSION['search'][$_REQUEST['_search']]); - $OUTPUT->set_env('search_request', $_REQUEST['_search']); - } $next = $prev = $first = $last = -1; // get previous, first, next and last message UID if ((!($_SESSION['sort_col'] == 'date' && $_SESSION['sort_order'] == 'DESC') && - $IMAP->get_capability('sort') ) && !(!empty($_REQUEST['_search']) && - isset($_SESSION['search'][$_REQUEST['_search']])) ) + $IMAP->get_capability('sort')) || !empty($_REQUEST['_search'])) { // Only if we use custom sorting $a_msg_index = $IMAP->message_index(NULL, $_SESSION['sort_col'], $_SESSION['sort_order']); @@ -102,23 +95,6 @@ if ($_GET['_uid']) $next = isset($a_msg_index[$MESSAGE['index']+1]) ? $a_msg_index[$MESSAGE['index']+1] : -1 ; $last = count($a_msg_index)>0 ? $a_msg_index[count($a_msg_index)-1] : -1; } - elseif (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search']])) - { - $search_data = $_SESSION['search'][$_REQUEST['_search']]; - $result = $IMAP->search(NULL, $search_data[0], $search_data[1],$search_data[3]); - $result = array_reverse($result); - foreach ($result as $key=>$rid) - { - $result[$key] = $IMAP->get_uid($rid); - if ($MESSAGE['UID'] == $result[$key]) - $seq = $key; - } - $prev = isset($result[$seq-1]) ? $result[$seq-1] : -1 ; - $first = count($result)>0 ? $result[0] : -1; - $next = isset($result[$seq+1]) ? $result[$seq+1] : -1 ; - $last = count($result)>0 ? $result[count($result)-1] : -1; - $MESSAGE['index'] = $seq; - } else { // this assumes that we are sorted by date_DESC |