'sent_folder' => $sent_mail_folder,
'save_attachments' => Horde_Util::getFormData('save_attachments_select'),
'encrypt' => $prefs->isLocked('default_encrypt') ? $prefs->getValue('default_encrypt') : Horde_Util::getFormData('encrypt_options'),
- 'priority' => Horde_Util::getFormData('x_priority'),
+ 'priority' => Horde_Util::getFormData('priority'),
'readreceipt' => Horde_Util::getFormData('request_read_receipt')
);
$t->set('priority_label', Horde::label('priority', _("_Priority")));
$t->set('priority_tabindex', ++$tabindex);
- $priority = Horde_Util::getFormData('x_priority', 3);
+ $priority = Horde_Util::getFormData('priority', 'normal');
$priorities = array(
- 1 => '1 (' . _("Highest") . ')',
- 2 => '2 (' . _("High") . ')',
- 3 => '3 (' . _("Normal") . ')',
- 4 => '4 (' . _("Low") . ')',
- 5 => '5 (' . _("Lowest") . ')'
+ 'high' => _("High"),
+ 'normal' => _("Normal"),
+ 'low' => _("Low")
);
$priority_option = array();
foreach ($priorities as $key => $val) {
'type' => 'checkbox',
'desc' => _("Display confirmation after sending a message?"));
-// allow the user to add a "X-Priority" header when composing messages?
+// allow the user to add a priority header when composing messages?
$_prefs['set_priority'] = array(
'value' => 1,
// Locked by default
'locked' => true,
'shared' => false,
'type' => 'checkbox',
- 'desc' => _("Set the X-Priority header when composing messages?"));
+ 'desc' => _("Set a priority header when composing messages?"));
// compose in a separate window?
$_prefs['compose_popup'] = array(
v5.0-git
--------
+[mms] Simplify and improve priority header generation/display.
[mms] Add Face: header support to IMP.
[mms] Add splitbar to resize sidebar in DIMP.
[mms] Use LIST-EXTENDED IMAP extension (RFC 5258) to get subscribed
RFC 5258 LIST-EXTENDED
RFC 5267 ESORT
RFC 5464 METADATA
+RFC 5530 IMAP Response Codes
RFC 5550 Lemonade Profile (specifically [2.8] - $Forwarded flag)
draft-ietf-morg-sortdisplay-02 SORT=DISPLAY
+draft-ietf-morg-inthread-00 THREAD=REFS
+
POP3
Face Header (view support)
- http://quimby.gnus.org/circus/face/
+
+Importance/Priority Header
+ - See, e.g., RFC 4356 [2.1.3.3.1]
+ http://kb.mozillazine.org/Emulate_Microsoft_email_clients
* 'encrypt' => (integer) A flag whether to encrypt or sign the message.
* One of IMP::PGP_ENCRYPT, IMP::PGP_SIGNENC,
* IMP::SMIME_ENCRYPT, or IMP::SMIME_SIGNENC.
- * 'priority' => (integer) The message priority from 1 to 5.
+ * 'priority' => (string) The message priority ('high', 'normal', 'low').
* 'readreceipt' => (bool) Add return receipt headers?
* 'useragent' => (string) The User-Agent string to use.
* </pre>
$headers->addReceivedHeader();
$headers->addMessageIdHeader();
- /* Add the X-Priority header, if requested. */
+ /* Add priority header, if requested. */
if (!empty($opts['priority'])) {
- $priority = $opts['priority'];
- switch ($priority) {
- case 1:
- $priority .= ' (Highest)';
+ switch ($opts['priority']) {
+ case 'high':
+ $headers->addHeader('Importance', 'High');
+ $headers->addHeader('X-Priority', '1 (Highest)');
break;
- case 2:
- $priority .= ' (High)';
- break;
-
- case 3:
- $priority .= ' (Normal)';
- break;
-
- case 4:
- $priority .= ' (Low)';
- break;
-
- case 5:
- $priority .= ' (Lowest)';
+ case 'low':
+ $headers->addHeader('Importance', 'Low');
+ $headers->addHeader('X-Priority', '5 (Lowest)');
break;
}
- $headers->addHeader('X-Priority', $priority);
}
$headers->addHeader('Date', date('r'));
* addresses as returned by
* Horde_Mime_Address::getAddressesFromObject(), or the
* identity that matched the address list..
- * 'priority' - (string) Message priority. The content of the X-Priority
- * header.
+ * 'priority' - (Horde_Mime_Headers) Determines priority information from
+ * a headers object.
* </pre>
*
* @return array A list of flags with the following keys:
}
if (!empty($options['priority'])) {
- $imp_msg_ui = new IMP_Ui_Message();
- switch ($imp_msg_ui->getXpriority($options['priority'])) {
+ $imp_hdr_ui = new IMP_Ui_Headers();
+ switch ($imp_hdr_ui->getPriority($options['priority'])) {
case 'high':
$process['highpri'] = $f['highpri'];
break;
* @param array $options Additional options:
* <pre>
* 'headers' - (boolean) Return info on the non-envelope headers
- * 'List-Post' and 'X-Priority'.
+ * 'Importance', 'List-Post', and 'X-Priority'.
* DEFAULT: false (only envelope headers returned)
* 'preview' - (mixed) Include preview information? If empty, add no
* preview information. If 1, uses value from prefs.
);
if (!empty($options['headers'])) {
- $fetch_criteria[Horde_Imap_Client::FETCH_HEADERS] = array(array('cache' => true, 'headers' => array('list-post', 'x-priority'), 'label' => 'imp', 'parse' => true, 'peek' => true));
+ $fetch_criteria[Horde_Imap_Client::FETCH_HEADERS] = array(array('cache' => true, 'headers' => array('importance', 'list-post', 'x-priority'), 'label' => 'imp', 'parse' => true, 'peek' => true));
}
if (!empty($options['structure'])) {
--- /dev/null
+<?php
+/**
+ * The IMP_Ui_Headers:: class is designed to provide a place to store common
+ * code shared among IMP's various UI views for header information.
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (GPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
+ *
+ * @author Michael Slusarz <slusarz@horde.org>
+ * @package IMP
+ */
+class IMP_Ui_Headers
+{
+ /**
+ * Determines the priority of the message based on the headers.
+ *
+ * @param Horde_Mime_Headers $header The headers object.
+ *
+ * @return string 'high', 'low', or 'normal'.
+ */
+ public function getPriority($header)
+ {
+ if (preg_match('/\s*(\d+)\s*/', $header->getValue('x-priority'), $matches)) {
+ if (in_array($matches[1], array(1, 2))) {
+ return 'high';
+ } elseif (in_array($matches[1], array(4, 5))) {
+ return 'low';
+ }
+ } elseif (preg_match('/:\s*(\w+)\s*/', $header->getValue('importance'), $matches)) {
+ if (strcasecmp($matches[1], 'high') === 0) {
+ return 'high';
+ } elseif (strcasecmp($matches[1], 'low') === 0) {
+ return 'low';
+ }
+ }
+
+ return 'normal';
+ }
+
+}
}
/**
- * Determines the X-Priority of the message based on the headers.
- *
- * @param string $header The X-Priority header.
- *
- * @return string 'high', 'low', or 'normal'.
- */
- public function getXpriority($header)
- {
- if ($header && preg_match('/\s*(\d+)\s*/', $header, $matches)) {
- if (in_array($matches[1], array(1, 2))) {
- return 'high';
- } elseif (in_array($matches[1], array(4, 5))) {
- return 'low';
- }
- }
-
- return 'normal';
- }
-
- /**
* Returns e-mail information for a mailing list.
*
* @param Horde_Mime_Headers $headers A Horde_Mime_Headers object.
'atc' => isset($ob['structure']) ? $ob['structure'] : null,
'flags' => $ob['flags'],
'personal' => Horde_Mime_Address::getAddressesFromObject($ob['envelope']['to']),
- 'priority' => $ob['headers']->getValue('x-priority')
+ 'priority' => $ob['headers']
));
if (!empty($flag_parse)) {
* 'bcc' - The Bcc addresses
* 'headers' - An array of headers (not including basic headers)
* 'list_info' - List information.
- * 'priority' - The X-Priority of the message ('low', 'high', 'normal')
+ * 'priority' - The priority of the message ('low', 'high', 'normal')
* 'replyTo' - The Reply-to addresses
* 'save_as' - The save link
* 'title' - The title of the page
$envelope = $fetch_ret[$uid]['envelope'];
$mime_headers = reset($fetch_ret[$uid]['headertext']);
- /* Get the IMP_Ui_Message:: object. */
+ /* Initialize variables. */
+ if (!$preview) {
+ $imp_hdr_ui = new IMP_Ui_Headers();
+ }
$imp_ui = new IMP_Ui_Message();
/* Develop the list of Headers to display now. Deal with the 'basic'
}
}
- /* Get X-Priority. */
+ /* Get message priority. */
if (!$preview) {
- $result['priority'] = $imp_ui->getXpriority($mime_headers->getValue('x-priority'));
+ $result['priority'] = $imp_hdr_ui->getPriority($mime_headers);
}
// Create message text and attachment list.
$flag_parse = $imp_flags->parse(array(
'flags' => $ob['flags'],
'personal' => Horde_Mime_Address::getAddressesFromObject($ob['envelope']['to']),
- 'priority' => $ob['headers']->getValue('x-priority')
+ 'priority' => $ob['headers']
));
foreach ($flag_parse as $val) {
'div' => true,
'flags' => $ob['flags'],
'personal' => Horde_Mime_Address::getAddressesFromObject($ob['envelope']['to']),
- 'priority' => $ob['headers']->getValue('x-priority')
+ 'priority' => $ob['headers']
));
$subject_flags = array();
}
$imp_message = IMP_Message::singleton();
+$imp_hdr_ui = new IMP_Ui_Headers();
$imp_ui = new IMP_Ui_Message();
/* Determine if mailbox is readonly. */
/* Check for the presence of mailing list information. */
$list_info = $imp_ui->getListInformation($mime_headers);
-/* See if the 'X-Priority' header has been set. */
-$xpriority = $mime_headers->getValue('x-priority');
-switch ($imp_ui->getXpriority($xpriority)) {
+/* See if the priority has been set. */
+switch($priority = $imp_hdr_ui->getPriority($mime_headers)) {
case 'high':
case 'low':
$basic_headers['priority'] = _("Priority");
- $display_headers['priority'] = $xpriority;
+ $display_headers['priority'] = Horde_String::ucfirst($priority);
break;
}
$indices_array = array($mailbox_name => array($uid));
$imp_flags = IMP_Imap_Flags::singleton();
+$imp_hdr_ui = new IMP_Ui_Headers();
$imp_ui = new IMP_Ui_Message();
switch ($actionID) {
$title = sprintf(_("%s: %s"), $page_label, $shortsub);
}
-/* See if the 'X-Priority' header has been set. */
-$xpriority = $mime_headers->getValue('x-priority');
-switch ($imp_ui->getXpriority($xpriority)) {
+/* See if the priority has been set. */
+switch ($priority = $imp_hdr_ui->getPriority($mime_headers)) {
case 'high':
$basic_headers['priority'] = _("Priority");
- $display_headers['priority'] = '<div class="msgflags flagHighpriority" title="' . htmlspecialchars(_("High Priority")) . '"></div> ' . $xpriority;
+ $display_headers['priority'] = '<div class="msgflags flagHighpriority" title="' . htmlspecialchars(_("High Priority")) . '"></div> ' . _("High");
break;
case 'low':
$basic_headers['priority'] = _("Priority");
- $display_headers['priority'] = '<div class="msgflags flagLowpriority" title="' . htmlspecialchars(_("Low Priority")) . '"></div> ' . $xpriority;
+ $display_headers['priority'] = '<div class="msgflags flagLowpriority" title="' . htmlspecialchars(_("Low Priority")) . '"></div> ' . _("Low");
break;
}
/* Skip the header if we have already dealt with it. */
if (!isset($display_headers[$head]) &&
!isset($all_list_headers[$head]) &&
- (($head != 'x-priority') || !isset($display_headers['priority']))) {
+ (!in_array($head, array('importance', 'x-priority')) ||
+ !isset($display_headers['priority']))) {
$full_headers[$head] = $val;
}
}
<strong><tag:priority_label /> </strong>
</td>
<td class="item">
- <select id="priority" name="x_priority" tabindex="<tag:priority_tabindex />">
+ <select id="priority" name="priority" tabindex="<tag:priority_tabindex />">
<loop:pri_opt>
<option value="<tag:pri_opt.val />" <if:pri_opt.selected>selected="selected" </if:pri_opt.selected>><tag:pri_opt.label /></option>
</loop:pri_opt>