mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-17 10:51:38 +01:00
* felamimail: improve connection handling regarding the validation of connections via expected responses
This commit is contained in:
parent
8f42df6881
commit
1f10e743d4
@ -3342,15 +3342,19 @@ class felamimail_bo
|
||||
|
||||
function openConnection($_icServerID=0, $_adminConnection=false)
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__.'->'.$_icServerID);
|
||||
static $isError;
|
||||
if ( PEAR::isError($isError[$_icServerID]) ) return false;
|
||||
//error_log(__METHOD__.__LINE__.'->'.$_icServerID.' called from '.function_backtrace());
|
||||
if (!is_object($this->mailPreferences))
|
||||
{
|
||||
error_log(__METHOD__." No Object for MailPreferences found.". function_backtrace());
|
||||
$this->errorMessage .= lang('No valid data to create MailProfile!!');
|
||||
$isError[$_icServerID] = new PEAR_Error($this->errorMessage);
|
||||
return false;
|
||||
}
|
||||
if(!$this->icServer = $this->mailPreferences->getIncomingServer((int)$_icServerID)) {
|
||||
$this->errorMessage .= lang('No active IMAP server found!!');
|
||||
$isError[$_icServerID] = new PEAR_Error($this->errorMessage);
|
||||
return false;
|
||||
}
|
||||
//error_log(__METHOD__.__LINE__.'->'.array2string($this->icServer->ImapServerId));
|
||||
@ -3362,17 +3366,24 @@ class felamimail_bo
|
||||
$errormessage .= "<br>".lang('Please ask the administrator to correct the emailadmin IMAP Server Settings for you.');
|
||||
}
|
||||
$this->icServer->_connectionErrorObject->message .= $this->errorMessage .= $errormessage;
|
||||
$isError[$_icServerID] = new PEAR_Error($this->errorMessage);
|
||||
return false;
|
||||
}
|
||||
//error_log( "-------------------------->open connection ".function_backtrace());
|
||||
//error_log(__METHOD__.__LINE__.' ->'.array2string($this->icServer));
|
||||
if ($this->icServer->_connected == 1) {
|
||||
$tretval = $this->icServer->selectMailbox($this->icServer->currentMailbox);
|
||||
if ( PEAR::isError($tretval) ) $isError[$_icServerID] = $tretval;
|
||||
//error_log(__METHOD__." using existing Connection ProfileID:".$_icServerID.' Status:'.print_r($this->icServer->_connected,true));
|
||||
} else {
|
||||
//error_log( "-------------------------->open connection for Server with profileID:".$_icServerID.function_backtrace());
|
||||
$this->icServer->_timeout = 5;
|
||||
$tretval = $this->icServer->openConnection($_adminConnection);
|
||||
//error_log(__METHOD__." open new Connection ProfileID:".$_icServerID.' Status:'.print_r($this->icServer->_connected,true));
|
||||
if ( PEAR::isError($tretval) || $tretval===false)
|
||||
{
|
||||
$isError[$_icServerID] = $this->icServer->_connectionErrorObject;
|
||||
error_log(__METHOD__." failed to open new Connection ProfileID:".$_icServerID.' Status:'.print_r($this->icServer->_connected,true).' Message:'.$this->icServer->_connectionErrorObject->message.' called from '.function_backtrace());
|
||||
}
|
||||
}
|
||||
//error_log(print_r($this->icServer->_connected,true));
|
||||
return $tretval;
|
||||
|
Loading…
Reference in New Issue
Block a user