backporting some fixes for the display of the message list, and filtering issues

This commit is contained in:
Klaus Leithoff 2008-10-07 09:52:18 +00:00
parent 7dddf8041f
commit 64a409adae

View File

@ -1166,9 +1166,16 @@
$filter = $this->createIMAPFilter($_folderName, $_filter);
if($this->icServer->hasCapability('SORT')) {
$sortOrder = $this->_getSortString($_sort);
if (!empty($this->displayCharset)) {
$sortResult = $this->icServer->sort($sortOrder, strtoupper( $this->displayCharset ), $filter, true);
}
if (PEAR::isError($sortResult) || empty($this->displayCharset)) {
$sortResult = $this->icServer->sort($sortOrder, 'US-ASCII', $filter, true);
}
} else {
$sortResult = $this->icServer->search($filter, true);
$advFilter = 'CHARSET '. strtoupper($this->displayCharset) .' '.$filter;
$sortResult = $this->icServer->search($advFilter, true);
if (PEAR::isError($sortResult)) $sortResult = $this->icServer->search($filter, true);
if(is_array($sortResult)) {
sort($sortResult, SORT_NUMERIC);
}
@ -1290,7 +1297,7 @@
}
$count = 0;
if (is_array($headersNew)) {
foreach((array)$headersNew as $headerObject) {
#if($count == 0) _debug_array($headerObject);
$uid = $headerObject['UID'];
@ -1306,14 +1313,15 @@
$retValue['header'][$sortOrder[$uid]]['mimetype'] = $headerObject['MIMETYPE'];
$retValue['header'][$sortOrder[$uid]]['id'] = $headerObject['MSG_NUM'];
$retValue['header'][$sortOrder[$uid]]['uid'] = $headerObject['UID'];
if (is_array($headerObject['FLAGS'])) {
$retValue['header'][$sortOrder[$uid]]['recent'] = in_array('\\Recent', $headerObject['FLAGS']);
$retValue['header'][$sortOrder[$uid]]['flagged'] = in_array('\\Flagged', $headerObject['FLAGS']);
$retValue['header'][$sortOrder[$uid]]['answered'] = in_array('\\Answered', $headerObject['FLAGS']);
$retValue['header'][$sortOrder[$uid]]['deleted'] = in_array('\\Deleted', $headerObject['FLAGS']);
$retValue['header'][$sortOrder[$uid]]['seen'] = in_array('\\Seen', $headerObject['FLAGS']);
$retValue['header'][$sortOrder[$uid]]['draft'] = in_array('\\Draft', $headerObject['FLAGS']);
if(is_array($headerObject['FROM'][0])) {
}
if(is_array($headerObject['FROM']) && is_array($headerObject['FROM'][0])) {
if($headerObject['FROM'][0]['HOST_NAME'] != 'NIL') {
$retValue['header'][$sortOrder[$uid]]['sender_address'] = $headerObject['FROM'][0]['EMAIL'];
} else {
@ -1325,7 +1333,7 @@
}
if(is_array($headerObject['TO'][0])) {
if(is_array($headerObject['TO']) && is_array($headerObject['TO'][0])) {
if($headerObject['TO'][0]['HOST_NAME'] != 'NIL') {
$retValue['header'][$sortOrder[$uid]]['to_address'] = $headerObject['TO'][0]['EMAIL'];
} else {
@ -1339,7 +1347,6 @@
$count++;
}
// sort the messages to the requested displayorder
if(is_array($retValue['header'])) {
ksort($retValue['header']);
@ -1354,6 +1361,15 @@
$retValue['info']['last'] = 0;
return $retValue;
}
} else {
error_log("bofelamimail::getHeaders -> retrieval of Message Details failed: ".print_r($headersNew,TRUE));
$retValue = array();
$retValue['info']['total'] = 0;
$retValue['info']['first'] = 0;
$retValue['info']['last'] = 0;
return $retValue;
}
}
function getNextMessage($_foldername, $_id)