=cut
our $Users = {};
-# FIXME
-our $HostmaskCache = init ('$HostmaskCache', 'hash');
+our $IdentToName = {};
+our $NameToIdent = {};
+
my $VERSION = '$Id: Users.pm,v 1.2 2004/08/01 13:45:27 octo Exp $';
print STDERR $/, __FILE__, ": $VERSION" if ($::DEBUG);
my $ident = shift;
my $name = '';
- if (defined ($HostmaskCache->{$ident}))
+ if (defined ($IdentToName->{$ident}))
{
- $name = $HostmaskCache->{$ident};
+ $name = $IdentToName->{$ident};
}
else
{
}
}
- $HostmaskCache->{$ident} = $name;
+ $IdentToName->{$ident} = $name;
+ $NameToIdent->{$name} = $ident if ($name);
return ($name);
}
}
}
+=item B<name_to_ident> (I<$name>)
+
+Does the reverse of B<ident_to_name>: Returns the most recent association of
+I<$name> to an ident. This function should rarely be needed..
+
+=cut
+
+sub name_to_ident
+{
+ my $name = shift;
+
+ if (defined ($NameToIdent->{$name}))
+ {
+ return ($NameToIdent->{$name});
+ }
+ else
+ {
+ return ('');
+ }
+}
+
=item B<get_realname> (I<$name>)
Returns the B<real name> for this (user)name as defined in the config. Sorry