summaryrefslogtreecommitdiff
path: root/program/steps/mail
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps/mail')
-rw-r--r--program/steps/mail/func.inc9
-rw-r--r--program/steps/mail/search.inc12
2 files changed, 16 insertions, 5 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 491f79a5e..3dab087b0 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -19,6 +19,11 @@
*/
+// setup some global vars used by mail steps
+$SENT_MBOX = $RCMAIL->config->get('sent_mbox');
+$DRAFTS_MBOX = $RCMAIL->config->get('drafts_mbox');
+$SEARCH_MODS_DEFAULT = array('*' => array('subject'=>1, 'from'=>1), $SENT_MBOX => array('subject'=>1, 'to'=>1), $DRAFTS_MBOX => array('subject'=>1, 'to'=>1));
+
$EMAIL_ADDRESS_PATTERN = '([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9][a-z0-9\-\.]*\\.[a-z]{2,5})';
// actions that do not require imap connection
@@ -79,7 +84,9 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list')
$OUTPUT->set_env('search_request', $search_request);
}
- $OUTPUT->set_env('search_mods', $_SESSION['search_mods'] ? $_SESSION['search_mods'] : array('subject'=>'subject'));
+ $search_mods = $RCMAIL->config->get('search_mods', $SEARCH_MODS_DEFAULT);
+ $OUTPUT->set_env('search_mods', $search_mods);
+
// make sure the message count is refreshed (for default view)
$IMAP->messagecount($mbox_name, 'ALL', true);
}
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);