Skip to content

Commit

Permalink
Merge pull request #12 from josaphatim/added-renamed-script-command
Browse files Browse the repository at this point in the history
Added support for rename script command and has mechanism method
  • Loading branch information
kroky authored May 7, 2024
2 parents 601cb7d + 79c0a7a commit dbed4e5
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/ManageSieve/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,16 @@ public function getSASLMechanisms() {
}
}

/**
* Return true if server support the mechanism
*
* @return bool
*/
public function hasSASLMechanism($mech)
{
return in_array($mech, $this->getSASLMechanisms());
}

/**
* Authenticate to server
*
Expand Down Expand Up @@ -717,4 +727,21 @@ public function noop()
}
return false;
}

/**
* Rename a user's Sieve script
*
* @param string $oldName The old Script name
* @param string $newName The new Script name
*
* @return boolean
*/
public function renameScript($oldName, $newName)
{
$return_payload = $this->sendCommand("RENAMESCRIPT", ['"'.$oldName.'"', '"'.$newName.'"',]);
if ($return_payload["code"] == "OK") {
return true;
}
return false;
}
}

0 comments on commit dbed4e5

Please sign in to comment.