support dparameters (structure part 8) for images while parsing the message body structure

This commit is contained in:
Klaus Leithoff 2011-07-21 14:56:45 +00:00
parent 204d961150
commit 6c4d5dfc48

View File

@ -414,15 +414,16 @@ class Net_IMAP extends Net_IMAPProtocol {
} }
#return $ret; #return $ret;
} }
# this seems to be obsolet, since errors while retrieving header informations are 'covered' above // this seems to be obsolet, since errors while retrieving header informations are 'covered' above
#if(strtoupper($ret["RESPONSE"]["CODE"]) != "OK"){ if(strtoupper($ret["RESPONSE"]["CODE"]) != "OK")
# error_log("egw-pear::NET::IMAP:getSummary->ResponseCode not OK"); {
# return new PEAR_Error($ret["RESPONSE"]["CODE"] . ", " . $ret["RESPONSE"]["STR_CODE"]); error_log("egw-pear::NET::IMAP:getSummary->ResponseCode not OK");
#} return new PEAR_Error($ret["RESPONSE"]["CODE"] . ", " . $ret["RESPONSE"]["STR_CODE"]);
}
#print "<hr>"; //print "<hr>";
#error_log("egw-pear::NET::IMAP:getSummary->".print_r($ret["PARSED"],TRUE)); //if (PEAR::isError($ret)) error_log("egw-pear::NET::IMAP:getSummary->".print_r($ret->message,TRUE));
#print "<hr>"; //print "<hr>";
if(isset( $ret["PARSED"] ) ){ if(isset( $ret["PARSED"] ) ){
for($i=0; $i<count($ret["PARSED"]) ; $i++){ for($i=0; $i<count($ret["PARSED"]) ; $i++){
if ($ret["PARSED"][$i]['COMMAND'] != 'FETCH') continue; if ($ret["PARSED"][$i]['COMMAND'] != 'FETCH') continue;
@ -709,6 +710,19 @@ class Net_IMAP extends Net_IMAPProtocol {
$part = $this->_parseStructureCommonFields($_structure); $part = $this->_parseStructureCommonFields($_structure);
$part->cid = $_structure[3]; $part->cid = $_structure[3];
$part->partID = $_partID; $part->partID = $_partID;
// there may be a part 8 for images too, ...
if(is_array($_structure[8])) {
if(isset($_structure[8][0]) && $_structure[8][0] != 'NIL') {
$part->disposition = strtoupper($_structure[8][0]);
}
if(is_array($_structure[8][1])) {
foreach($_structure[8][1] as $key => $value) {
if($key%2 == 0) {
$part->dparameters[trim(strtoupper($_structure[8][1][$key]))] = $_structure[8][1][$key+1];
}
}
}
}
$_mimeParts[$_partID] = $part; $_mimeParts[$_partID] = $part;
} }