refactoring: log_event(), is_format_valid()

This commit is contained in:
Serghey Rodin 2016-06-09 16:31:56 +03:00
commit e05dca61a6
211 changed files with 756 additions and 1091 deletions

View file

@ -28,7 +28,7 @@ source $VESTA/conf/vesta.conf
#----------------------------------------------------------#
check_args '4' "$#" 'USER DOMAIN ACCOUNT FORWARD'
validate_format 'user' 'domain' 'account' 'forward'
is_format_valid 'user' 'domain' 'account' 'forward'
is_system_enabled "$MAIL_SYSTEM" 'MAIL_SYSTEM'
is_object_valid 'user' 'USER' "$user"
is_object_unsuspended 'user' 'USER' "$user"
@ -39,7 +39,7 @@ is_object_unsuspended "mail/$domain" 'ACCOUNT' "$account"
fwd=$(get_object_value "mail/$domain" 'ACCOUNT' "$account" '$FWD')
if [ ! -z "$(echo $fwd | grep -w $forward)" ]; then
echo "Error: forward $forward exists"
log_event "$E_EXISTS $EVENT"
log_event "$E_EXISTS $ARGUMENTS"
exit $E_EXISTS
fi
@ -71,6 +71,6 @@ update_object_value "mail/$domain" 'ACCOUNT' "$account" '$FWD' "$fwd"
# Logging
log_history "added forwarding from $account@$domain to $forward"
log_event "$OK" "$EVENT"
log_event "$OK" "$ARGUMENTS"
exit