From b0388fa9a687d621be3d8d9a7c1d88e24eeab05f Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sat, 25 Jan 2020 19:55:43 -0800 Subject: [PATCH] Users: drop "my_" prefix; ensure account does not already exist --- PBot/Users.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/PBot/Users.pm b/PBot/Users.pm index d3665282..d76287f9 100644 --- a/PBot/Users.pm +++ b/PBot/Users.pm @@ -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;