From a5f46234bc3b8ac3983d9afa23405292105a4c7e Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Sat, 14 Feb 2004 01:07:14 +0000 Subject: example of use of "complete" callback --- postfix_wizard/Postfix.pm | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'postfix_wizard') diff --git a/postfix_wizard/Postfix.pm b/postfix_wizard/Postfix.pm index 9e04696f..46991f39 100755 --- a/postfix_wizard/Postfix.pm +++ b/postfix_wizard/Postfix.pm @@ -83,7 +83,13 @@ $o->{pages} = { pre => sub { $o->{var}{wiz_mail_masquerade} ||= get_mail_masquerade(); }, - post => \&check_masquerade, + complete => sub { + print "in is $::in\n"; + if ($o->{var}{wiz_mail_masquerade} !~ /\w+\.\w+$/) { + $::in->ask_warn(N("Error"), N("Masquerade should be a valid domain name such as \"mydomain.com\"!")); + return 1; + } + }, data => [ { label => N("Masquerade domain name:"), val => \$o->{var}{wiz_mail_masquerade} }, ], @@ -93,10 +99,6 @@ $o->{pages} = { name => N("Warning:") . "\n\n" . N("You entered an empty address for the mail gateway.") . "\n\n" . N("Your choice can be accepted, but this will not allow you to send mail outside your local network. Press next to continue, or back to enter a value."), next => 'summaryext', }, - masquerade_not_good => { - name => N("Error.") . "\n\n" . N("Masquerade not good!"), - next => 'external' - }, error_sendmail => { name => N("Error, sendmail is installed, please remove it before install and configure Postfix"), no_back => 1, @@ -172,10 +174,6 @@ sub check_sendmail { undef $w; } -sub check_masquerade { - $o->{var}{wiz_mail_masquerade} or return 'masquerade_not_good'; - $o->{var}{wiz_mail_masquerade} =~ /\w+\.\w+$/ or return 'masquerade_not_good'; -} sub check_relay { $o->{var}{wiz_ext_mail_relay} or return 'warning'; -- cgit v1.2.1