summaryrefslogtreecommitdiff
path: root/program/steps/mail
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps/mail')
-rw-r--r--program/steps/mail/func.inc53
-rw-r--r--program/steps/mail/list.inc24
-rw-r--r--program/steps/mail/sendmail.inc11
3 files changed, 72 insertions, 16 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 418c52b0a..a6f8b3f94 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -528,6 +528,36 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE)
}
+// return code for search function
+function rcmail_search_form($attrib)
+ {
+ global $OUTPUT, $JS_OBJECT_NAME;
+
+ // add some labels to client
+ rcube_add_label('searching');
+
+ $attrib['name'] = '_q';
+
+ if (empty($attrib['id']))
+ $attrib['id'] = 'rcmqsearchbox';
+
+ $input_q = new textfield($attrib);
+ $out = $input_q->show();
+
+ $OUTPUT->add_script(sprintf("%s.gui_object('qsearchbox', '%s');",
+ $JS_OBJECT_NAME,
+ $attrib['id']));
+
+ // add form tag around text field
+ if (empty($attrib['form']))
+ $out = sprintf('<form name="rcmqsearchform" action="./" '.
+ 'onsubmit="%s.command(\'search\');return false" style="display:inline;">%s</form>',
+ $JS_OBJECT_NAME,
+ $out);
+
+ return $out;
+ }
+
function rcmail_messagecount_display($attrib)
{
@@ -536,7 +566,9 @@ function rcmail_messagecount_display($attrib)
if (!$attrib['id'])
$attrib['id'] = 'rcmcountdisplay';
- $OUTPUT->add_script(sprintf("%s.gui_object('countdisplay', '%s');", $JS_OBJECT_NAME, $attrib['id']));
+ $OUTPUT->add_script(sprintf("%s.gui_object('countdisplay', '%s');",
+ $JS_OBJECT_NAME,
+ $attrib['id']));
// allow the following attributes to be added to the <span> tag
$attrib_str = create_attrib_string($attrib, array('style', 'class', 'id'));
@@ -560,16 +592,20 @@ function rcmail_quota_display($attrib)
// allow the following attributes to be added to the <span> tag
$attrib_str = create_attrib_string($attrib, array('style', 'class', 'id'));
-
+
+ if (!$IMAP->get_capability('QUOTA'))
+ $quota_text = rcube_label('unknown');
+ else if (!($quota_text = $IMAP->get_quota()))
+ $quota_text = rcube_label('unlimited');
$out = '<span' . $attrib_str . '>';
- $out .= $IMAP->get_quota();
+ $out .= $quota_text;
$out .= '</span>';
return $out;
}
-function rcmail_get_messagecount_text()
+function rcmail_get_messagecount_text($count=NULL, $page=NULL)
{
global $IMAP, $MESSAGE;
@@ -577,11 +613,14 @@ function rcmail_get_messagecount_text()
{
return rcube_label(array('name' => 'messagenrof',
'vars' => array('nr' => $MESSAGE['index']+1,
- 'count' => $IMAP->messagecount())));
+ 'count' => $count!==NULL ? $count : $IMAP->messagecount())));
}
- $start_msg = ($IMAP->list_page-1) * $IMAP->page_size + 1;
- $max = $IMAP->messagecount();
+ if ($page===NULL)
+ $page = $IMAP->list_page;
+
+ $start_msg = ($page-1) * $IMAP->page_size + 1;
+ $max = $count!==NULL ? $count : $IMAP->messagecount();
if ($max==0)
$out = rcube_label('mailboxempty');
diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc
index 391c05b73..40cd652df 100644
--- a/program/steps/mail/list.inc
+++ b/program/steps/mail/list.inc
@@ -22,8 +22,6 @@
$REMOTE_REQUEST = TRUE;
$OUTPUT_TYPE = 'js';
-$unseen = $IMAP->messagecount($mbox, 'UNSEEN', !empty($_GET['_refresh']) ? TRUE : FALSE);
-$count = $IMAP->messagecount();
$sort = isset($_GET['_sort']) ? $_GET['_sort'] : false;
// is there a sort type for this request?
@@ -37,13 +35,28 @@ if ($sort)
$_SESSION['sort_order'] = $sort_order;
}
else
- {
+ {
// use session settings if set, defaults if not
$sort_col = isset($_SESSION['sort_col']) ? $_SESSION['sort_col'] : $CONFIG['message_sort_col'];
$sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order'];
}
+// we have a saved search request
+if (!empty($_GET['_search']) && isset($_SESSION['search'][$_GET['_search']]))
+ {
+ $a_msgs = split(',', $_SESSION['search'][$_GET['_search']]);
+ $a_headers = $IMAP->list_header_set($mbox, $a_msgs, NULL, $sort_col, $sort_order);
+ $count = count($a_msgs);
+ }
+else
+ {
+ if ($count = $IMAP->messagecount())
+ $a_headers = $IMAP->list_headers($mbox, NULL, $sort_col, $sort_order);
+ }
+
+$unseen = $IMAP->messagecount($mbox, 'UNSEEN', !empty($_GET['_refresh']) ? TRUE : FALSE);
+
// update message count display
$pages = ceil($count/$IMAP->page_size);
$commands = sprintf("this.set_env('messagecount', %d);\n", $count);
@@ -56,11 +69,8 @@ $commands .= sprintf("this.set_unread_count('%s', %d);\n", addslashes($mbox), $u
// add message rows
-if ($count)
- {
- $a_headers = $IMAP->list_headers($mbox, null, $sort_col, $sort_order);
+if (isset($a_headers) && count($a_headers))
$commands .= rcmail_js_message_list($a_headers);
- }
// send response
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 70baba039..33f023de1 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -159,9 +159,16 @@ if (!empty($CONFIG['generic_message_footer']))
}
}
-
+// try to autodetect operating system and use the correct line endings
// use the configured delimiter for headers
-$header_delm = $CONFIG['mail_header_delimiter'] ? $CONFIG['mail_header_delimiter'] : "\r\n";
+if (!empty($CONFIG['mail_header_delimiter']))
+ $header_delm = $CONFIG['mail_header_delimiter'];
+else if (strtolower(substr(PHP_OS, 0, 3)=='win'))
+ $header_delm = "\r\n";
+else if (strtolower(substr(PHP_OS, 0, 3)=='mac'))
+ $header_delm = "\r\n";
+else
+ $header_delm = "\n";
// create PEAR::Mail_mime instance
$MAIL_MIME = new Mail_mime($header_delm);