explicitly set login-type from mail-account for smtp plugins, otherwise we depend on no longer updated config from setup

This commit is contained in:
Ralf Becker 2014-11-19 20:30:06 +00:00
parent 3b8a7f9e9c
commit ba0fe9a9eb
3 changed files with 6 additions and 8 deletions

View File

@ -434,6 +434,7 @@ class emailadmin_account implements ArrayAccess
$smtp->username = $params['acc_smtp_username']; $smtp->username = $params['acc_smtp_username'];
$smtp->password = $params['acc_smtp_password']; $smtp->password = $params['acc_smtp_password'];
$smtp->defaultDomain = $params['acc_domain']; $smtp->defaultDomain = $params['acc_domain'];
$smtp->loginType = $params['acc_imap_login_type'];
return $smtp; return $smtp;
} }
@ -1317,7 +1318,6 @@ class emailadmin_account implements ArrayAccess
*/ */
static function get_default_acc_id($smtp=false) static function get_default_acc_id($smtp=false)
{ {
//error_log(__METHOD__.__LINE__.'Smtp?'.array2string($smtp));
try try
{ {
foreach(emailadmin_account::search(true, 'params') as $acc_id => $params) foreach(emailadmin_account::search(true, 'params') as $acc_id => $params)
@ -1326,8 +1326,6 @@ class emailadmin_account implements ArrayAccess
{ {
if (!$params['acc_smtp_host'] || !$params['acc_smtp_port']) continue; if (!$params['acc_smtp_host'] || !$params['acc_smtp_port']) continue;
// check requirement of session, which is not available in async service! // check requirement of session, which is not available in async service!
//error_log(__METHOD__.__LINE__.array2string($params));
//error_log(__METHOD__.__LINE__.'is async:'.array2string($GLOBALS['egw_info']['flags']['async-service']));
if (isset($GLOBALS['egw_info']['flags']['async-service'])) if (isset($GLOBALS['egw_info']['flags']['async-service']))
{ {
if ($params['acc_smtp_auth_session']) continue; if ($params['acc_smtp_auth_session']) continue;
@ -1338,17 +1336,16 @@ class emailadmin_account implements ArrayAccess
} }
catch (Exception $x) catch (Exception $x)
{ {
unset($x);
continue; continue;
} }
if ($account->acc_smtp_pw_enc == emailadmin_credentials::USER) continue; if ($account->acc_smtp_pw_enc == emailadmin_credentials::USER) continue;
//error_log(__METHOD__.__LINE__.array2string($account->params));
} }
} }
else else
{ {
if (!$params['acc_imap_host'] || !$params['acc_imap_port']) continue; if (!$params['acc_imap_host'] || !$params['acc_imap_port']) continue;
$account = new emailadmin_account($params); $account = new emailadmin_account($params);
//error_log(__METHOD__.__LINE__.' '.$acc_id.':'.array2string($account));
// continue if we have either no imap username or password // continue if we have either no imap username or password
if (!$account->is_imap()) continue; if (!$account->is_imap()) continue;
} }

View File

@ -52,7 +52,6 @@ class emailadmin_bo
function __construct($_profileID=false,$_restoreSesssion=true) function __construct($_profileID=false,$_restoreSesssion=true)
{ {
parent::__construct(self::APP,self::TABLE,null,'',true);
//error_log(__METHOD__.function_backtrace()); //error_log(__METHOD__.function_backtrace());
if (!is_object($GLOBALS['emailadmin_bo'])) if (!is_object($GLOBALS['emailadmin_bo']))
{ {

View File

@ -67,6 +67,8 @@ class emailadmin_smtp
var $defaultDomain; var $defaultDomain;
var $loginType;
/** /**
* Constructor * Constructor
* *
@ -214,13 +216,13 @@ class emailadmin_smtp
* @param int|array $account account_id or whole account array with values for keys * @param int|array $account account_id or whole account array with values for keys
* @param string $domain=null domain, default use $this->defaultDomain * @param string $domain=null domain, default use $this->defaultDomain
* @param string $mail_login_type=null standard(uid), vmailmgr(uid@domain), email or uidNumber, * @param string $mail_login_type=null standard(uid), vmailmgr(uid@domain), email or uidNumber,
* default use $GLOBALS['egw_info']['server']['mail_login_type'] * default use $this->loginType
* @return string * @return string
*/ */
/*static*/ public function mailbox_addr($account,$domain=null,$mail_login_type=null) /*static*/ public function mailbox_addr($account,$domain=null,$mail_login_type=null)
{ {
if (is_null($domain)) $domain = $this->defaultDomain; if (is_null($domain)) $domain = $this->defaultDomain;
if (is_null($mail_login_type)) $mail_login_type = $GLOBALS['egw_info']['server']['mail_login_type']; if (is_null($mail_login_type)) $mail_login_type = $this->loginType;
switch($mail_login_type) switch($mail_login_type)
{ {