public function connect($user_id = null, array $credentials = null)
{
$this->_data['user']['id'] = $user_id;
if (isset($credentials['password'])) {
$password = $credentials['password'];
} else {
$password = '';
}
try {
$this->_server->connect($this->_data['user']['id'], $password);
$user_object = $this->_server->objects->fetch();
} catch (Horde_Kolab_Server_Exception_Bindfailed $e) {
throw new Horde_Kolab_Session_Exception_Badlogin('Invalid credentials!', 0, $e);
} catch (Horde_Kolab_Server_Exception $e) {
throw new Horde_Kolab_Session_Exception('Login failed!', 0, $e);
}
$this->_initMail($user_object);
$this->_initUid($user_object);
$this->_initName($user_object);
$this->_initImapServer($user_object);
$this->_initFreebusyServer($user_object);
}