fixing 2 problems regarding the communication with a dovecotserver. CAPABILITIES and parseStructureCommonFields

This commit is contained in:
Klaus Leithoff 2009-03-05 10:43:04 +00:00
parent f6f32e3f9f
commit 26555a065c
2 changed files with 19 additions and 4 deletions

View File

@ -840,10 +840,19 @@ class Net_IMAP extends Net_IMAPProtocol {
*/
function _parseStructureCommonFields(&$_structure)
{
#error_log(__METHOD__.print_r($_structure,true)." ".function_backtrace());
#print "Net_IMAP::_parseStructureTextArray _partID: $_partID<br>";
$part = new stdClass;
$part->type = strtoupper($_structure[0]);
$part->subType = strtoupper($_structure[1]);
//dovecot has no subtype for type attachment, and does not pass it as structure[2]
if (!is_array($_structure[1])) $part->subType = strtoupper($_structure[1]);
if(is_array($_structure[1])) {
foreach($_structure[1] as $key => $value) {
if($key%2 == 0) {
$part->parameters[strtoupper($_structure[1][$key])] = $_structure[1][$key+1];
}
}
}
if(is_array($_structure[2])) {
foreach($_structure[2] as $key => $value) {
if($key%2 == 0) {

View File

@ -1006,7 +1006,13 @@ class Net_IMAPProtocol {
$ret = $this->_genericCommand( 'CAPABILITY' );
if(isset( $ret["PARSED"] ) ){
$ret["PARSED"]=$ret["PARSED"][0]["EXT"]["CAPABILITY"];
foreach($ret["PARSED"] as $substruct) {
if ($substruct["COMMAND"] == "CAPABILITY") {
$subrv=$substruct["EXT"]["CAPABILITY"];
break;
}
}
$ret["PARSED"]=$subrv;
//fill the $this->_serverAuthMethods and $this->_serverSupportedCapabilities arrays
foreach( $ret["PARSED"]["CAPABILITIES"] as $auth_method ){
if( strtoupper( substr( $auth_method , 0 ,5 ) ) == "AUTH=" )
@ -2878,8 +2884,8 @@ class Net_IMAPProtocol {
$ext_arr=$this->_getEXTarray($str_aux);
//$ext_arr=array($token=>$this->_getEXTarray($str_aux));
}else{
$ext_arr=$str_line;
//$ext_arr=array($token=>$str_line);
//$ext_arr=$str_line;
$ext_arr=array($token=>$str_line);
}
$result_array = $ext_arr;
return $result_array;