1
0
mirror of https://github.com/anope/anope.git synced 2026-06-30 23:06:40 +02:00

Remove the asynchronous identifing hack and replace it with something better. Fixes m_*_authentication only being able to properly work when people identify normally using nickserv/identify

This commit is contained in:
Adam
2012-10-07 22:39:58 -04:00
parent 0a111c1976
commit b8b63ff115
54 changed files with 687 additions and 470 deletions
+1
View File
@@ -52,6 +52,7 @@ Module::~Module()
ModuleManager::DetachAll(this);
/* Clear any active callbacks this module has */
ModuleManager::ClearCallBacks(this);
IdentifyRequest::ModuleUnload(this);
std::list<Module *>::iterator it = std::find(Modules.begin(), Modules.end(), this);
if (it != Modules.end())
+59
View File
@@ -93,3 +93,62 @@ void change_core_display(NickCore *nc)
change_core_display(nc, na->nick);
}
std::set<IdentifyRequest *> IdentifyRequest::requests;
IdentifyRequest::IdentifyRequest(const Anope::string &acc, const Anope::string &pass) : account(acc), password(pass), dispatched(false), success(false)
{
requests.insert(this);
}
IdentifyRequest::~IdentifyRequest()
{
requests.erase(this);
}
void IdentifyRequest::Hold(Module *m)
{
holds.insert(m);
}
void IdentifyRequest::Release(Module *m)
{
holds.erase(m);
if (holds.empty() && dispatched)
{
if (!success)
this->OnFail();
delete this;
}
}
void IdentifyRequest::Success(Module *m)
{
if (!success)
{
this->OnSuccess();
success = true;
}
}
void IdentifyRequest::Dispatch()
{
if (holds.empty())
{
if (!success)
this->OnFail();
delete this;
}
else
dispatched = true;
}
void IdentifyRequest::ModuleUnload(Module *m)
{
for (std::set<IdentifyRequest *>::iterator it = requests.begin(), it_end = requests.end(); it != it_end;)
{
IdentifyRequest *ir = *it;
++it;
ir->Release(m);
}
}