Skip to content

Commit

Permalink
Merge branch 'ralfbecker-sieve-namespace-fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Feb 1, 2016
2 parents 10f4ac8 + 7fdd179 commit 9c6786c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 24 deletions.
32 changes: 15 additions & 17 deletions framework/ManageSieve/lib/Horde/ManageSieve.php
Expand Up @@ -17,7 +17,6 @@

namespace Horde;
use Horde\Socket\Client;
use Horde\ManageSieve;
use Horde\ManageSieve\Exception;

/**
Expand Down Expand Up @@ -258,7 +257,7 @@ protected function _handleConnectAndLogin()
* @param string $port Port of server.
* @param array $context List of options to pass to
* stream_context_create().
* @param boolean $secure: Security layer requested. @see __construct().
* @param boolean $secure Security layer requested. @see __construct().
*
* @throws \Horde\ManageSieve\Exception
*/
Expand All @@ -283,7 +282,7 @@ public function connect(
}

if (self::STATE_DISCONNECTED != $this->_state) {
throw new NotDisconnected();
throw new Exception\NotDisconnected();
}

try {
Expand All @@ -295,7 +294,7 @@ public function connect(
$this->_params['context']
);
} catch (Client\Exception $e) {
throw new Exception($e);
throw new Exception\ConnectionFailed($e);
}

if ($this->_params['bypassauth']) {
Expand All @@ -310,12 +309,11 @@ public function connect(
try {
$this->_cmdCapability();
} catch (Exception $e) {
throw new ConnectionFailed($e);
throw new Exception\ConnectionFailed($e);
}

// Check if we can enable TLS via STARTTLS.
if ($this->_params['secure'] === 'tls' ||
$this->_params['secure'] === 'tlsv1' ||
($this->_params['secure'] === true &&
!empty($this->_capability['starttls']))) {
$this->_doCmd('STARTTLS');
Expand All @@ -338,7 +336,7 @@ public function connect(
try {
$this->_cmdCapability();
} catch (Exception $e) {
throw new ConnectionFailed($e);
throw new Exception\ConnectionFailed($e);
}
}
}
Expand All @@ -362,7 +360,7 @@ public function disconnect($sendLogoutCMD = true)
* Defaults from the constructor are used for missing parameters.
*
* @param string $user Login username.
* @param string $pass Login password.
* @param string $password Login password.
* @param string $authmethod Type of login method to use.
* @param string $euser Effective UID (perform on behalf of $euser).
*
Expand All @@ -375,13 +373,13 @@ public function login(
if (isset($user)) {
$this->_params['user'] = $user;
}
if (isset($user)) {
if (isset($password)) {
$this->_params['password'] = $password;
}
if (isset($user)) {
if (isset($authmethod)) {
$this->_params['authmethod'] = $authmethod;
}
if (isset($user)) {
if (isset($euser)) {
$this->_params['euser'] = $euser;
}

Expand Down Expand Up @@ -621,7 +619,7 @@ protected function _cmdAuthenticate(
try {
$this->_cmdCapability();
} catch (Exception $e) {
throw new ConnectionFailed($e);
throw new Exception\ConnectionFailed($e);
}
}

Expand Down Expand Up @@ -968,7 +966,7 @@ protected function _recvBytes($length)
*
* @throws \Horde\ManageSieve\Exception if a NO response.
* @return string Reponse string if an OK response.
*
*
*/
protected function _doCmd($cmd = '', $auth = false)
{
Expand Down Expand Up @@ -1023,7 +1021,7 @@ protected function _doCmd($cmd = '', $auth = false)
try {
$this->_handleConnectAndLogin();
} catch (Exception $e) {
throw new Referral(
throw new Exception\Referral(
'Cannot follow referral to '
. $this->_params['host'] . ', the error was: '
. $e->getMessage()
Expand Down Expand Up @@ -1058,7 +1056,7 @@ protected function _doCmd($cmd = '', $auth = false)
}
}

throw new Referral('Max referral count (' . $referralCount . ') reached.');
throw new Exception\Referral('Max referral count (' . $referralCount . ') reached.');
}

/**
Expand Down Expand Up @@ -1119,7 +1117,7 @@ protected function _getBestAuthMethod($authmethod = null)
protected function _checkConnected()
{
if (self::STATE_DISCONNECTED == $this->_state) {
throw new NotConnected();
throw new Exception\NotConnected();
}
}

Expand All @@ -1131,7 +1129,7 @@ protected function _checkConnected()
protected function _checkAuthenticated()
{
if (self::STATE_AUTHENTICATED != $this->_state) {
throw new NotAuthenticated();
throw new Exception\NotAuthenticated();
}
}

Expand Down
Expand Up @@ -23,14 +23,14 @@
* @license http://www.horde.org/licenses/bsd BSD
* @package ManageSieve
*/
class ConnectionFailed extends Exception
class ConnectionFailed extends ManageSieve\Exception
{
/**
* Exception constructor.
*
* @param Exception $message An Exception object.
* @param Exception $e An Exception object.
*/
public function __construct(Exception $e)
public function __construct(\Exception $e)
{
parent::__construct('Failed to connect, server said: ' . $e->getMessage());
}
Expand Down
Expand Up @@ -23,7 +23,7 @@
* @license http://www.horde.org/licenses/bsd BSD
* @package ManageSieve
*/
class NotAuthenticated extends Exception
class NotAuthenticated extends ManageSieve\Exception
{
/**
* Exception constructor.
Expand Down
Expand Up @@ -23,7 +23,7 @@
* @license http://www.horde.org/licenses/bsd BSD
* @package ManageSieve
*/
class NotConnected extends Exception
class NotConnected extends ManageSieve\Exception
{
/**
* Exception constructor.
Expand Down
Expand Up @@ -23,7 +23,7 @@
* @license http://www.horde.org/licenses/bsd BSD
* @package ManageSieve
*/
class NotDisconnected extends Exception
class NotDisconnected extends ManageSieve\Exception
{
/**
* Exception constructor.
Expand Down
Expand Up @@ -23,6 +23,6 @@
* @license http://www.horde.org/licenses/bsd BSD
* @package ManageSieve
*/
class Referral extends Exception
class Referral extends ManageSieve\Exception
{
}

0 comments on commit 9c6786c

Please sign in to comment.