aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Fripost/Schema.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Fripost/Schema.pm')
-rw-r--r--lib/Fripost/Schema.pm19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Fripost/Schema.pm b/lib/Fripost/Schema.pm
index bb1f3f5..ad88c82 100644
--- a/lib/Fripost/Schema.pm
+++ b/lib/Fripost/Schema.pm
@@ -211,6 +211,25 @@ under the same terms as perl itself.
=cut
+sub _dn2email {
+ my $self = shift;
+ my $dn = shift;
+ $dn =~ s/^fvd=([^,]+),.*/\@$1/ and return $dn;
+ $dn =~ s/^fv(?:u|a|l)=([^,]+),fvd=([^,]+),.*/$1\@$2/
+ or die "Wrong usage: of _dn2email: $dn";
+ return $dn;
+}
+sub _email2dn {
+ my $self = shift;
+ my $email = shift;
+ my ($l,$d) = split /\@/, $email, 2;
+ die "Wrong usage: of _email2dn: $email" unless defined $d;
+
+ my $dn = "fvd=$d,".$self->suffix;
+ $dn = "fvu=$l,".$dn if $l ne '';
+ return $dn;
+}
+
1;
__END__