From 906d5f24374eb190f6b7a00523fb16e5e683ac81 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Wed, 19 Sep 2012 02:10:41 +0200 Subject: Better way to create lists. --- lib/Fripost/Schema/Domain.pm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib/Fripost/Schema/Domain.pm') diff --git a/lib/Fripost/Schema/Domain.pm b/lib/Fripost/Schema/Domain.pm index 3f2c9c5..8017e00 100644 --- a/lib/Fripost/Schema/Domain.pm +++ b/lib/Fripost/Schema/Domain.pm @@ -48,7 +48,7 @@ sub search { ); if ($domains->code) { die $options{'-die'}."\n" if defined $options{'-die'}; - die $domains->error; + die $domains->error."\n"; } return map { { domain => domain_to_unicode($_->get_value('fvd')) , isactive => $_->get_value('fripostIsStatusActive') eq 'TRUE' @@ -86,7 +86,7 @@ sub get { ); if ($domains->code) { die $options{'-die'}."\n" if defined $options{'-die'}; - die $domains->error; + die $domains->error."\n"; } # The following is not supposed to happen. @@ -100,7 +100,7 @@ sub get { return ( domain => domain_to_unicode($domain->get_value('fvd')) , isactive => $domain->get_value('fripostIsStatusActive') eq 'TRUE' , description => concat($concat, $domain->get_value('description')) - , catchalls => concat($concat, map { email_to_unicode ($_) } + , catchalls => concat($concat, map { _email_to_unicode ($_) } $domain->get_value('fripostOptionalMaildrop')) , permissions => get_perms($domain, $self->whoami) ) @@ -168,6 +168,14 @@ sub _is_valid { } +# A variante of email_to_unicode that also takes care of domain aliases. +sub _email_to_unicode { + my $email = shift; + return '@'.domain_to_unicode($email) if $email =~ s/^\@//; + return email_to_unicode($email); +} + + =head1 AUTHOR Guilhem Moulin C<< >> -- cgit v1.2.3