The mutt-script now displays groups as extra info
[licom.git] / mutt-licom.pl
index 08c2502..e7fbcbd 100755 (executable)
@@ -24,6 +24,12 @@ else
        $Config = get_config ();
 }
 
+if ($ENV{'DEBUG'})
+{
+       require Data::Dumper;
+       print STDERR Data::Dumper->Dump ([$Config], ['Config']);
+}
+
 unless (defined ($Config->{'uri'}) and defined ($Config->{'bind_dn'})
        and defined ($Config->{'password'}))
 {
@@ -61,15 +67,19 @@ our @Matches = LiCoM::Person->search (@Patterns, [[mail => '*']]);
 
 print STDOUT scalar (@Matches), ' ', (scalar (@Matches) == 1 ? 'entry' : 'entries'), " found.\n";
 
-for (@Matches)
+for (sort { $a->name () cmp $b->name () } (@Matches))
 {
        my $person = $_;
        my $cn = $person->name ();
        my @mail = $person->get ('mail');
+       my @groups = $person->get ('group');
+       my $info = join (', ', sort (@groups));
+
+       $info = "($info)" if ($info);
 
-       for (@mail)
+       for (sort (@mail))
        {
-               print "$_\t$cn\tFound by LiCoM\n";
+               print "$_\t$cn\t$info\n";
        }
 }