summaryrefslogtreecommitdiff
path: root/program/steps/mail/search.inc
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2010-03-03 12:11:04 +0000
committerthomascube <thomas@roundcube.net>2010-03-03 12:11:04 +0000
commit7910c0ff55edcb9ed973abd680489b9e0f28d0cb (patch)
tree454e6565617cb80667c6f20e8ce985d1304d2acf /program/steps/mail/search.inc
parentd15d594a42e8fe4e6c11dedcd8ac3e89c445f986 (diff)
Remember search modifiers in user prefs (#1486146) + bring back the old defaults
Diffstat (limited to 'program/steps/mail/search.inc')
-rw-r--r--program/steps/mail/search.inc12
1 files changed, 8 insertions, 4 deletions
diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc
index 6a1c8c471..cfdb6fb96 100644
--- a/program/steps/mail/search.inc
+++ b/program/steps/mail/search.inc
@@ -72,12 +72,17 @@ else if (preg_match("/^body:.*/i", $str))
else if(trim($str))
{
if ($headers) {
- $headers = explode(',', $headers);
- foreach($headers as $header)
+ foreach(explode(',', $headers) as $header)
switch ($header) {
case 'text': $subject['text'] = 'TEXT'; break;
- default: $subject[$header] = 'HEADER '.$header;
+ default: $subject[$header] = 'HEADER '.strtoupper($header);
}
+
+ // save search modifiers for the current folder to user prefs
+ $search_mods = $RCMAIL->config->get('search_mods', $SEARCH_MODS_DEFAULT);
+ $search_mods[$mbox] = array_fill_keys(array_keys($subject), 1);
+ $RCMAIL->user->save_prefs(array('search_mods' => $search_mods));
+ console($search_mods);
} else {
// search in subject by default
$subject['subject'] = 'HEADER SUBJECT';
@@ -90,7 +95,6 @@ if ($subject) {
$search_str .= str_repeat(' OR', count($subject)-1);
foreach ($subject as $sub)
$search_str .= sprintf(" %s {%d}\r\n%s", $sub, strlen($search), $search);
- $_SESSION['search_mods'] = $subject;
}
$search_str = trim($search_str);