Change 'function' style (#3364)

This commit is contained in:
Casper 2023-05-26 01:01:41 +02:00 committed by GitHub
parent cf74127f78
commit 37ca0f9ba9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
60 changed files with 233 additions and 466 deletions

View file

@ -5,8 +5,7 @@
# - DATABASE_DOVECOT_MASTERS
# Logic to perform for requested operations handled here:
function _manage_accounts
{
function _manage_accounts() {
local ACTION=${1}
local DATABASE=${2}
local MAIL_ACCOUNT=${3}
@ -60,8 +59,7 @@ function _manage_accounts_dovecotmaster_delete { _manage_accounts 'delete' "${DA
# - Calling external method '__usage' as part of error handling.
# Also used by setquota, delquota
function _arg_expect_mail_account
{
function _arg_expect_mail_account() {
[[ -z ${MAIL_ACCOUNT} ]] && { __usage ; _exit_with_error 'No account specified' ; }
# Dovecot Master accounts are validated (they are not email addresses):
@ -71,8 +69,7 @@ function _arg_expect_mail_account
[[ ${MAIL_ACCOUNT} =~ .*\@.* ]] || { __usage ; _exit_with_error "'${MAIL_ACCOUNT}' should include the domain (eg: user@example.com)" ; }
}
function _account_should_not_exist_yet
{
function _account_should_not_exist_yet() {
__account_already_exists && _exit_with_error "'${MAIL_ACCOUNT}' already exists"
if [[ -f ${DATABASE_VIRTUAL} ]] && grep -q "^${MAIL_ACCOUNT}" "${DATABASE_VIRTUAL}"; then
_exit_with_error "'${MAIL_ACCOUNT}' is already defined as an alias"
@ -80,20 +77,17 @@ function _account_should_not_exist_yet
}
# Also used by delmailuser, setquota, delquota
function _account_should_already_exist
{
function _account_should_already_exist() {
! __account_already_exists && _exit_with_error "'${MAIL_ACCOUNT}' does not exist"
}
function __account_already_exists
{
function __account_already_exists() {
local DATABASE=${DATABASE:-"${DATABASE_ACCOUNTS}"}
_db_has_entry_with_key "${MAIL_ACCOUNT}" "${DATABASE}"
}
# Also used by addsaslpassword
function _password_request_if_missing
{
function _password_request_if_missing() {
if [[ -z ${PASSWD} ]]; then
read -r -s -p 'Enter Password: ' PASSWD
echo