From 6c4d5dfc4867810f1afd7f2cd18d7ea07fc5ddad Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Thu, 21 Jul 2011 14:56:45 +0000 Subject: [PATCH] support dparameters (structure part 8) for images while parsing the message body structure --- egw-pear/Net/IMAP.php | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/egw-pear/Net/IMAP.php b/egw-pear/Net/IMAP.php index 02b3201bd2..8f5aa72083 100644 --- a/egw-pear/Net/IMAP.php +++ b/egw-pear/Net/IMAP.php @@ -414,15 +414,16 @@ class Net_IMAP extends Net_IMAPProtocol { } #return $ret; } - # this seems to be obsolet, since errors while retrieving header informations are 'covered' above - #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"]); - #} + // this seems to be obsolet, since errors while retrieving header informations are 'covered' above + 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"]); + } - #print "
"; - #error_log("egw-pear::NET::IMAP:getSummary->".print_r($ret["PARSED"],TRUE)); - #print "
"; + //print "
"; + //if (PEAR::isError($ret)) error_log("egw-pear::NET::IMAP:getSummary->".print_r($ret->message,TRUE)); + //print "
"; if(isset( $ret["PARSED"] ) ){ for($i=0; $i_parseStructureCommonFields($_structure); $part->cid = $_structure[3]; $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; }