myvesta/bin/v-get-mail-domain-value
2017-03-05 23:34:07 +01:00

53 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# info: get mail domain value
# options: USER DOMAIN KEY
#
# The function for getting a certain mail domain parameter.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
user=$1
domain=$2
domain_idn=$2
key=$(echo "$3"| tr '[:lower:]' '[:upper:]' | sed "s/^/$/")
# Includes
source $VESTA/func/main.sh
# Additional argument formatting
format_domain
format_domain_idn
# TODO: $domain_idn not used in this script - maybe $domain should be converted to $doman_idn ?
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '3' "$#" 'USER DOMAIN KEY'
is_format_valid 'user' 'domain'
is_object_valid 'user' 'USER' "$user"
is_object_valid 'mail' 'DOMAIN' "$domain"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Print
get_object_value 'mail' 'DOMAIN' "$domain" "$key"
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$ARGUMENTS"
exit