instead of php xml extension. Fixes bug #655137.
- Added Wood theme and Silver Steel theme by Pavel Spatny and Simple Green theme
- Fix two time zone calculation bugs, thanks to David White
+ - 'Priority' and 'Importance' headers are now also recognised, next to the
+ 'X-Priority' header that we've supported since a long time.
Version 1.5.0
--------------------
$this->xmailer = $value;
break;
case 'x-priority':
- $this->priority = $value;
+ case 'importance':
+ case 'priority':
+ $this->priority = $this->parsePriority($value);
break;
case 'list-post':
$value = $this->stripComments($value);
}
}
+ /**
+ * Normalise the different Priority headers into a uniform value,
+ * namely that of the X-Priority header (1, 3, 5). Supports:
+ * Prioirty, X-Priority, Importance.
+ * X-MS-Mail-Priority is not parsed because it always coincides
+ * with one of the other headers.
+ *
+ * NOTE: this is actually a duplicate from the function in
+ * functions/imap_messages. I'm not sure if it's ok here to call
+ * that function?
+ */
+ function parsePriority($value) {
+ $value = strtolower(array_shift(split('/\w/',trim($value))));
+ if ( is_numeric($value) ) {
+ return $value;
+ }
+ if ( $value == 'urgent' || $value == 'high' ) {
+ return 1;
+ } elseif ( $value == 'non-urgent' || $value == 'low' ) {
+ return 5;
+ }
+ // default is normal priority
+ return 3;
+ }
+
function parseContentType($value) {
$pos = strpos($value, ';');
$props = '';
}
}
-?>
\ No newline at end of file
+?>
}
+function parsePriority($value) {
+ $value = strtolower(array_shift(split('/\w/',trim($value))));
+ if ( is_numeric($value) ) {
+ return $value;
+ }
+ if ( $value == 'urgent' || $value == 'high' ) {
+ return 1;
+ } elseif ( $value == 'non-urgent' || $value == 'low' ) {
+ return 5;
+ }
+ return 3;
+}
+
/**
* Parses a string in an imap response. String starts with " or { which means it
* can handle double quoted strings and literal strings
* @return array $aMessages associative array with messages. Key is the UID, value is an associative array
*/
function sqimap_get_small_header_list($imap_stream, $msg_list,
- $aHeaderFields = array('Date', 'To', 'Cc', 'From', 'Subject', 'X-Priority', 'Content-Type'),
+ $aHeaderFields = array('Date', 'To', 'Cc', 'From', 'Subject', 'X-Priority', 'Importance', 'Priority', 'Content-Type'),
$aFetchItems = array('FLAGS', 'RFC822.SIZE', 'INTERNALDATE')) {
$aMessageList = array();
case 'date':
$msg['DATE'] = str_replace(' ', ' ', $value);
break;
- case 'x-priority': $msg['PRIORITY'] = $value; break;
+ case 'x-priority':
+ case 'importance':
+ case 'priority':
+ $msg['PRIORITY'] = parsePriority($value); break;
case 'subject': $msg['SUBJECT'] = $value; break;
case 'content-type':
$type = $value;
}
// initialize the fields we want to retrieve:
- $aHeaderFields = array('Date', 'To', 'Cc', 'From', 'Subject', 'X-Priority', 'Content-Type');
+ $aHeaderFields = array('Date', 'To', 'Cc', 'From', 'Subject', 'X-Priority', 'Importance', 'Priority', 'Content-Type');
$aFetchItems = array('FLAGS', 'RFC822.SIZE');
// Are we sorting on internaldate then retrieve the internaldate value as well
}
// vim: et ts=4
-?>
\ No newline at end of file
+?>