1
0
mirror of https://github.com/anope/anope.git synced 2026-07-02 12:53:13 +02:00

Fix xline uid generation when the one chosen already exists

This commit is contained in:
Adam
2013-10-01 23:48:46 -04:00
parent b094132c9d
commit 353ee5cc93
2 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -447,7 +447,7 @@ void Anope::Init(int ac, char **av)
/* Initialize random number generator */
block = Config->GetBlock("options");
srand(block->Get<unsigned>("seed"));
srand(block->Get<unsigned>("seed") ^ time(NULL));
/* load modules */
Log() << "Loading modules...";
+4 -2
View File
@@ -220,11 +220,12 @@ Anope::string XLineManager::GenerateUID()
{
Anope::string id;
int count = 0;
while (id.empty() || XLinesByUID->count(id) > 0)
do
{
id.clear();
if (++count > 10)
{
id.clear();
Log(LOG_DEBUG) << "Unable to generate XLine UID";
break;
}
@@ -238,6 +239,7 @@ Anope::string XLineManager::GenerateUID()
id += c;
}
}
while (XLinesByUID->count(id) > 0);
return id;
}