some servers seem to sent their responses for the content not with the first EXT section, so we loop through the parsed response until we find some matching content

This commit is contained in:
Klaus Leithoff 2012-08-13 16:34:51 +00:00
parent 28354db5d5
commit ce46dc40d6

View File

@ -592,7 +592,12 @@ class Net_IMAP extends Net_IMAPProtocol {
if(strtoupper($ret["RESPONSE"]["CODE"]) != "OK"){ if(strtoupper($ret["RESPONSE"]["CODE"]) != "OK"){
return new PEAR_Error($ret["RESPONSE"]["CODE"] . ", " . $ret["RESPONSE"]["STR_CODE"]); return new PEAR_Error($ret["RESPONSE"]["CODE"] . ", " . $ret["RESPONSE"]["STR_CODE"]);
} }
$ret=$ret["PARSED"][0]["EXT"]["BODY[$partId]"]["CONTENT"]; $found = 0;
foreach($ret["PARSED"] as $key => $value)
{
if (isset($ret["PARSED"][$key]["EXT"]["BODY[$partId]"]["CONTENT"])) {$found = $key; break;}
}
$ret=$ret["PARSED"][$found]["EXT"]["BODY[$partId]"]["CONTENT"];
//$ret=$resp["PARSED"][0]["EXT"]["RFC822"]["CONTENT"]; //$ret=$resp["PARSED"][0]["EXT"]["RFC822"]["CONTENT"];
return $ret; return $ret;
} }
@ -1874,6 +1879,7 @@ class Net_IMAP extends Net_IMAPProtocol {
if (PEAR::isError($ret)) { if (PEAR::isError($ret)) {
return $ret; return $ret;
} }
if(strtoupper($ret["RESPONSE"]["CODE"]) != "OK"){ if(strtoupper($ret["RESPONSE"]["CODE"]) != "OK"){
return new PEAR_Error($ret["RESPONSE"]["CODE"] . ", " . $ret["RESPONSE"]["STR_CODE"]); return new PEAR_Error($ret["RESPONSE"]["CODE"] . ", " . $ret["RESPONSE"]["STR_CODE"]);
} }