* @return Horde_Kolab_Storage The storage connection.
*/
public function getStorage();
+
+ /**
+ * Return the connection status of this session.
+ *
+ * @return boolean True if the session has been successfully connected.
+ */
+ public function isConnected();
}
{
return $this->_session->getStorage();
}
+
+ /**
+ * Return the connection status of this session.
+ *
+ * @return boolean True if the session has been successfully connected.
+ */
+ public function isConnected()
+ {
+ return $this->_session->isConnected();
+ }
}
private $_storage;
/**
+ * Indicate if this session was successfully connected.
+ *
+ * @var array
+ */
+ private $_connected = false;
+
+ /**
* Constructor.
*
* @param string $user_id The session will be setup for the user
$this->_initName($user_object);
$this->_initImapServer($user_object);
$this->_initFreebusyServer($user_object);
+
+ $this->_connected = true;
}
/**
*/
public function getStorage()
{
- throw new Horde_Kolab_Session_Exception('Not implemented!');
+ if (empty($this->_storage)) {
+ //@todo: factory?
+ $this->_storage = new Horde_Kolab_Storage(
+ 'Imap',
+ //@todo: Use Session_Auth
+ array('hostspec' => $this->getImapServer(),
+ 'username' => Horde_Auth::getAuth(),
+ 'password' => Horde_Auth::getCredential('password'))
+ );
+ }
+ return $this->_storage;
+ }
+
+ /**
+ * Return the connection status of this session.
+ *
+ * @return boolean True if the session has been successfully connected.
+ */
+ public function isConnected()
+ {
+ return $this->_connected;
}
}
{
return $this->_session->getStorage();
}
+
+ /**
+ * Return the connection status of this session.
+ *
+ * @return boolean True if the session has been successfully connected.
+ */
+ public function isConnected()
+ {
+ return $this->_session->isConnected();
+ }
}
$config['logger'] = Horde::getLogger();
$factory = new Horde_Kolab_Session_Factory_Configuration($config);
self::$_instance = $factory->getSession($user);
- self::$_instance->connect($credentials);
+ if (!self::$_instance->isConnected()) {
+ self::$_instance->connect($credentials);
+ }
}
return self::$_instance;
}
{
return $this->_session->getStorage();
}
+
+ /**
+ * Return the connection status of this session.
+ *
+ * @return boolean True if the session has been successfully connected.
+ */
+ public function isConnected()
+ {
+ return $this->_session->isConnected();
+ }
}