check if the selected Method (if one is selected by function parameter) of Authentication is valid (suppoted by the Server), if not try BestMethod supported by server

This commit is contained in:
Klaus Leithoff 2010-06-18 09:27:35 +00:00
parent 2188402b1c
commit c7747b4d11

View File

@ -721,6 +721,16 @@ class Net_IMAPProtocol {
}
$serverMethods=implode(',' ,$this->_serverAuthMethods);
$myMethods=implode(',' ,$this->supportedAuthMethods);
if (!empty($userMethod) && !in_array($userMethod,$this->_serverAuthMethods))
{
foreach ( $this->supportedAuthMethods as $method ) {
if ( in_array( $method , $this->_serverAuthMethods ) ) {
error_log(__METHOD__." UserMethod $userMethod not supported by server; trying best ServerMethod $method");
return $method;
}
}
}
return new PEAR_Error("$method NOT supported authentication method!. This IMAP server " .
"supports these methods: $serverMethods, but I support $myMethods");
}else{