- Allow setting connection options in imap_connect hook

release-0.7
alecpl 13 years ago
parent 5d62d9af93
commit e7e79470e4

@ -615,7 +615,7 @@ class rcmail
// Setting root and delimiter before establishing the connection // Setting root and delimiter before establishing the connection
// can save time detecting them using NAMESPACE and LIST // can save time detecting them using NAMESPACE and LIST
$options = array( $options = array(
'auth_method' => $this->config->get('imap_auth_type', 'check'), 'auth_type' => $this->config->get('imap_auth_type', 'check'),
'auth_cid' => $this->config->get('imap_auth_cid'), 'auth_cid' => $this->config->get('imap_auth_cid'),
'auth_pw' => $this->config->get('imap_auth_pw'), 'auth_pw' => $this->config->get('imap_auth_pw'),
'debug' => (bool) $this->config->get('imap_debug', 0), 'debug' => (bool) $this->config->get('imap_debug', 0),

@ -176,12 +176,13 @@ class rcube_imap
$attempt = 0; $attempt = 0;
do { do {
$data = rcmail::get_instance()->plugins->exec_hook('imap_connect', $data = rcmail::get_instance()->plugins->exec_hook('imap_connect',
array('host' => $host, 'user' => $user, 'attempt' => ++$attempt)); array_merge($this->options, array('host' => $host, 'user' => $user,
'attempt' => ++$attempt)));
if (!empty($data['pass'])) if (!empty($data['pass']))
$pass = $data['pass']; $pass = $data['pass'];
$this->conn->connect($data['host'], $data['user'], $pass, $this->options); $this->conn->connect($data['host'], $data['user'], $pass, $data);
} while(!$this->conn->connected() && $data['retry']); } while(!$this->conn->connected() && $data['retry']);
$this->host = $data['host']; $this->host = $data['host'];

@ -672,8 +672,8 @@ class rcube_imap_generic
$this->prefs = $options; $this->prefs = $options;
} }
// set auth method // set auth method
if (!empty($this->prefs['auth_method'])) { if (!empty($this->prefs['auth_type'])) {
$auth_method = strtoupper($this->prefs['auth_method']); $auth_method = strtoupper($this->prefs['auth_type']);
} else { } else {
$auth_method = 'CHECK'; $auth_method = 'CHECK';
} }

Loading…
Cancel
Save