Skip to content

Commit

Permalink
Rename constants to be more intuitive and to more closely match RFC w…
Browse files Browse the repository at this point in the history
…ording.
  • Loading branch information
yunosh committed Jan 26, 2015
1 parent 3b2c00f commit 49352d6
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions framework/ManageSieve/lib/Horde/ManageSieve.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@
class ManageSieve
{
/**
* Disconnected state
* Client is disconnected.
*/
const STATE_DISCONNECTED = 1;

/**
* Authorisation state
* Client is connected but not authenticated.
*/
const STATE_AUTHORIZATION = 2;
const STATE_NON_AUTHENTICATED = 2;

/**
* Transaction state
* Client is authenticated.
*/
const STATE_TRANSACTION = 3;
const STATE_AUTHENTICATED = 3;

/**
* The authentication methods this class supports.
Expand Down Expand Up @@ -253,9 +253,9 @@ public function connect($host, $port, $options = null, $useTLS = true)
}

if ($this->_bypassAuth) {
$this->_state = self::STATE_TRANSACTION;
$this->_state = self::STATE_AUTHENTICATED;
} else {
$this->_state = self::STATE_AUTHORIZATION;
$this->_state = self::STATE_NON_AUTHENTICATED;
$this->_doCmd();
}

Expand Down Expand Up @@ -307,14 +307,14 @@ public function login($user, $pass, $logintype = null, $euser = '', $bypassAuth
$this->_data['euser'] = $euser;
$this->_bypassAuth = $bypassAuth;

if (self::STATE_AUTHORIZATION != $this->_state) {
throw new Exception('Not currently in AUTHORIZATION state', 1);
if (self::STATE_NON_AUTHENTICATED != $this->_state) {
}

if (!$bypassAuth ) {
$this->_cmdAuthenticate($user, $pass, $logintype, $euser);
}
$this->_state = self::STATE_TRANSACTION;
$this->_state = self::STATE_AUTHENTICATED;
}

/**
Expand Down Expand Up @@ -408,8 +408,8 @@ public function removeScript($scriptname)
*/
public function hasSpace($scriptname, $size)
{
if (self::STATE_TRANSACTION != $this->_state) {
throw new Exception('Not currently in TRANSACTION state', 1);
if (self::STATE_AUTHENTICATED != $this->_state) {
throw new Exception('Not currently in AUTHENTICATED state', 1);
}

try {
Expand Down Expand Up @@ -666,8 +666,8 @@ protected function _authEXTERNAL($user, $pass, $euser)
*/
protected function _cmdDeleteScript($scriptname)
{
if (self::STATE_TRANSACTION != $this->_state) {
throw new Exception('Not currently in AUTHORIZATION state', 1);
if (self::STATE_AUTHENTICATED != $this->_state) {
}
$this->_doCmd(sprintf('DELETESCRIPT %s', $this->_escape($scriptname)));
}
Expand All @@ -682,8 +682,8 @@ protected function _cmdDeleteScript($scriptname)
*/
protected function _cmdGetScript($scriptname)
{
if (self::STATE_TRANSACTION != $this->_state) {
throw new Exception('Not currently in AUTHORIZATION state', 1);
if (self::STATE_AUTHENTICATED != $this->_state) {
}

$this->_doCmd(sprintf('GETSCRIPT %s', $this->_escape($scriptname)));
Expand All @@ -701,8 +701,8 @@ protected function _cmdGetScript($scriptname)
*/
protected function _cmdSetActive($scriptname)
{
if (self::STATE_TRANSACTION != $this->_state) {
throw new Exception('Not currently in AUTHORIZATION state', 1);
if (self::STATE_AUTHENTICATED != $this->_state) {
}
$this->_doCmd(sprintf('SETACTIVE %s', $this->_escape($scriptname)));
}
Expand All @@ -716,8 +716,8 @@ protected function _cmdSetActive($scriptname)
*/
protected function _cmdListScripts()
{
if (self::STATE_TRANSACTION != $this->_state) {
throw new Exception('Not currently in AUTHORIZATION state', 1);
if (self::STATE_AUTHENTICATED != $this->_state) {
}

$res = $this->_doCmd('LISTSCRIPTS');
Expand Down Expand Up @@ -748,8 +748,8 @@ protected function _cmdListScripts()
*/
protected function _cmdPutScript($scriptname, $scriptdata)
{
if (self::STATE_TRANSACTION != $this->_state) {
throw new Exception('Not currently in AUTHORIZATION state', 1);
if (self::STATE_AUTHENTICATED != $this->_state) {
}

$stringLength = $this->_getLineLength($scriptdata);
Expand Down

0 comments on commit 49352d6

Please sign in to comment.