aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Fripost/Commands/add_alias.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Fripost/Commands/add_alias.pm')
-rw-r--r--lib/Fripost/Commands/add_alias.pm5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Fripost/Commands/add_alias.pm b/lib/Fripost/Commands/add_alias.pm
index 7155368..8581a9f 100644
--- a/lib/Fripost/Commands/add_alias.pm
+++ b/lib/Fripost/Commands/add_alias.pm
@@ -19,6 +19,7 @@ use IO::Prompter;
use Fripost::Prompt;
use Fripost::Schema;
use Fripost::Email;
+use Fripost::Tests;
our $VERSION = '0.01';
@@ -32,6 +33,10 @@ sub main {
my @addr = @_;
@addr || push @addr, (split /, */, prompt "Alias from address(es): ");
+ my $graph = build_alias_graph ($ldap->alias->search()->entries);
+ my @path = search_path ($graph, $goto, $addr[0]);
+ die "Error: Cannot create cycle " . join (' -> ', @path) . ' -> ' . $goto . "\n"
+ if @path;
# Show goto adress
say "Goto adress: $goto";