From 26555a065c51a9934c817cae388c06b5c8f91843 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Thu, 5 Mar 2009 10:43:04 +0000 Subject: [PATCH] fixing 2 problems regarding the communication with a dovecotserver. CAPABILITIES and parseStructureCommonFields --- egw-pear/Net/IMAP.php | 11 ++++++++++- egw-pear/Net/IMAPProtocol.php | 12 +++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/egw-pear/Net/IMAP.php b/egw-pear/Net/IMAP.php index 96e26bb60a..9cd0d4b9dd 100644 --- a/egw-pear/Net/IMAP.php +++ b/egw-pear/Net/IMAP.php @@ -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
"; $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) { diff --git a/egw-pear/Net/IMAPProtocol.php b/egw-pear/Net/IMAPProtocol.php index 8460f2c235..6fcb7a2ba5 100644 --- a/egw-pear/Net/IMAPProtocol.php +++ b/egw-pear/Net/IMAPProtocol.php @@ -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;