add missing prepareFlagsArray

This commit is contained in:
Klaus Leithoff 2013-08-22 07:18:15 +00:00
parent 552ab8218f
commit 45201e9c29

View File

@ -3180,24 +3180,7 @@ class felamimail_bo
$retValue['header'][$sortOrder[$uid]]['uid'] = $headerObject['UID'];
$retValue['header'][$sortOrder[$uid]]['priority'] = ($headerObject['PRIORITY']?$headerObject['PRIORITY']:3);
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]]['forwarded'] = in_array('$Forwarded', $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']);
$retValue['header'][$sortOrder[$uid]]['mdnsent'] = in_array('MDNSent', $headerObject['FLAGS']);
$retValue['header'][$sortOrder[$uid]]['mdnnotsent'] = in_array('MDNnotSent', $headerObject['FLAGS']);
if (is_array($headerObject['FLAGS'])) $headerFlags = array_map('strtolower',$headerObject['FLAGS']);
if (!empty($headerFlags))
{
$retValue['header'][$sortOrder[$uid]]['label1'] = in_array('$label1', $headerFlags);
$retValue['header'][$sortOrder[$uid]]['label2'] = in_array('$label2', $headerFlags);
$retValue['header'][$sortOrder[$uid]]['label3'] = in_array('$label3', $headerFlags);
$retValue['header'][$sortOrder[$uid]]['label4'] = in_array('$label4', $headerFlags);
$retValue['header'][$sortOrder[$uid]]['label5'] = in_array('$label5', $headerFlags);
}
$retValue['header'][$sortOrder[$uid]] = array_merge($retValue['header'][$sortOrder[$uid]],self::prepareFlagsArray($headerObject));
}
if(is_array($headerObject['FROM']) && is_array($headerObject['FROM'][0])) {
if($headerObject['FROM'][0]['HOST_NAME'] != 'NIL') {
@ -3280,6 +3263,36 @@ class felamimail_bo
}
}
/**
* static function prepareFlagsArray
* prepare headerObject to return some standardized array to tell which flags are set for a message
* @param array $headerObject - array to process, a full return array from icServer->getSummary
* @return array array of flags
*/
static function prepareFlagsArray($headerObject)
{
$retValue = array();
$retValue['recent'] = in_array('\\Recent', $headerObject['FLAGS']);
$retValue['flagged'] = in_array('\\Flagged', $headerObject['FLAGS']);
$retValue['answered'] = in_array('\\Answered', $headerObject['FLAGS']);
$retValue['forwarded'] = in_array('$Forwarded', $headerObject['FLAGS']);
$retValue['deleted'] = in_array('\\Deleted', $headerObject['FLAGS']);
$retValue['seen'] = in_array('\\Seen', $headerObject['FLAGS']);
$retValue['draft'] = in_array('\\Draft', $headerObject['FLAGS']);
$retValue['mdnsent'] = in_array('MDNSent', $headerObject['FLAGS']);
$retValue['mdnnotsent'] = in_array('MDNnotSent', $headerObject['FLAGS']);
if (is_array($headerObject['FLAGS'])) $headerFlags = array_map('strtolower',$headerObject['FLAGS']);
if (!empty($headerFlags))
{
$retValue['label1'] = in_array('$label1', $headerFlags);
$retValue['label2'] = in_array('$label2', $headerFlags);
$retValue['label3'] = in_array('$label3', $headerFlags);
$retValue['label4'] = in_array('$label4', $headerFlags);
$retValue['label5'] = in_array('$label5', $headerFlags);
}
return $retValue;
}
function getNextMessage($_foldername, $_id)
{
if (empty($this->sessionData['folderStatus'])) $this->restoreSessionData();