myvesta/bin/v-get-mail-account-value
2013-10-27 13:54:31 +02:00

50 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# info: get mail account value
# options: USER DOMAIN ACCOUNT KEY
#
# The function for getting a certain mail account parameter.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument defenition
user=$1
domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain")
account=$3
key=$(echo "$4"| tr '[:lower:]' '[:upper:]' | sed "s/^/$/")
# Includes
source $VESTA/func/main.sh
#----------------------------------------------------------#
# Verifications #
#----------------------------------------------------------#
check_args '3' "$#" 'USER DOMAIN KEY'
validate_format 'user' 'domain'
is_object_valid 'user' 'USER' "$user"
is_object_valid 'mail' 'DOMAIN' "$domain"
is_object_valid "mail/$domain" 'ACCOUNT' "$account"
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
# Print
get_object_value "mail/$domain" 'ACCOUNT' "$account" "$key"
#----------------------------------------------------------#
# Vesta #
#----------------------------------------------------------#
# Logging
log_event "$OK" "$EVENT"
exit