3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-03 01:48:38 +02:00

Users: drop "my_" prefix; ensure account does not already exist

This commit is contained in:
Pragmatic Software 2020-01-25 19:55:43 -08:00
parent 7a326ba7fe
commit b0388fa9a6

View File

@ -443,7 +443,15 @@ sub mycmd {
if (not $u) {
$channel = '.*';
$hostmask = "$nick!*\@*";
$u = $self->add_user("my_$nick", $channel, $hostmask, undef, undef, 1);
my $name = $nick;
my ($existing_channel, $existing_hostmask) = $self->find_user_account($channel, $name);
if ($existing_hostmask ne $name) {
# user exists by name
return "There is already an user account named $name but it does not match your hostmask. Ask an admin for help.";
}
$u = $self->add_user($name, $channel, $hostmask, undef, undef, 1);
$u->{loggedin} = 1;
$u->{stayloggedin} = 1;
$u->{autologin} = 1;