1
0
mirror of https://github.com/anope/anope.git synced 2026-07-08 04:23:14 +02:00

Don't allow adding or changing bots to collide with users

This commit is contained in:
Adam
2015-06-29 08:42:29 -04:00
parent bb5c4906cc
commit 3e3312db25
+19 -3
View File
@@ -75,6 +75,13 @@ class CommandBSBot : public Command
return;
}
User *u = User::Find(nick, true);
if (u)
{
source.Reply(_("User \2%s\2 is already in use."), u->nick.c_str());
return;
}
BotInfo *bi = new BotInfo(nick, user, host, real);
Log(LOG_ADMIN, source, this) << "ADD " << bi->GetMask() << " " << bi->realname;
@@ -161,10 +168,19 @@ class CommandBSBot : public Command
return;
}
if (!nick.equals_ci(bi->nick) && BotInfo::Find(nick, true))
if (!nick.equals_ci(bi->nick))
{
source.Reply(_("Bot \002%s\002 already exists."), nick.c_str());
return;
if (BotInfo::Find(nick, true))
{
source.Reply(_("Bot \002%s\002 already exists."), nick.c_str());
return;
}
if (User::Find(nick, true))
{
source.Reply(_("User \2%s\2 is already in use."), nick.c_str());
return;
}
}
if (!nick.equals_ci(bi->nick))