mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-07-16 04:14:52 +02:00
Change 'function' style (#3364)
This commit is contained in:
parent
cf74127f78
commit
37ca0f9ba9
60 changed files with 233 additions and 466 deletions
|
@ -3,8 +3,7 @@
|
|||
# Manage DB writes for: DATABASE_QUOTA
|
||||
|
||||
# Logic to perform for requested operations handled here:
|
||||
function _manage_dovecot_quota
|
||||
{
|
||||
function _manage_dovecot_quota() {
|
||||
local ACTION=${1}
|
||||
local MAIL_ACCOUNT=${2}
|
||||
# Only for ACTION 'update':
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
# mail to an alias address.
|
||||
|
||||
# Logic to perform for requested operations handled here:
|
||||
function _manage_virtual_aliases
|
||||
{
|
||||
function _manage_virtual_aliases() {
|
||||
local ACTION=${1}
|
||||
local MAIL_ALIAS=${2}
|
||||
local RECIPIENT=${3}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue