LocalUser* New = NULL;
try
{
- New = new LocalUser();
+ New = new LocalUser(socket, client, server);
}
catch (...)
{
return;
}
- New->SetFd(socket);
- memcpy(&New->client_sa, client, sizeof(irc::sockets::sockaddrs));
- memcpy(&New->server_sa, server, sizeof(irc::sockets::sockaddrs));
-
/* Give each of the modules an attempt to hook the user for I/O */
FOREACH_MOD(I_OnHookIO, OnHookIO(New, via));
this->unregistered_count++;
- (*(this->clientlist))[New->uuid] = New;
-
/* The users default nick is their UUID */
New->nick.assign(New->uuid, 0, ServerInstance->Config->Limits.NickMax);
+ (*(this->clientlist))[New->nick] = New;
New->ident.assign("unknown");
if (IS_LOCAL(user))
{
- FOREACH_MOD(I_OnUserDisconnect,OnUserDisconnect(IS_LOCAL(user)));
- user->DoWrite();
- if (user->GetIOHook())
+ LocalUser* lu = IS_LOCAL(user);
+ FOREACH_MOD(I_OnUserDisconnect,OnUserDisconnect(lu));
+ lu->DoWrite();
+ if (lu->GetIOHook())
{
try
{
- user->GetIOHook()->OnStreamSocketClose(user);
+ lu->GetIOHook()->OnStreamSocketClose(lu);
}
catch (CoreException& modexcept)
{
}
}
- ServerInstance->SE->DelFd(user);
- user->Close();
- // user->Close() will set fd to -1; this breaks IS_LOCAL. Fix
- user->SetFd(INT_MAX);
+ ServerInstance->SE->DelFd(lu);
+ lu->Close();
}
/*
void UserManager::RemoveCloneCounts(User *user)
{
- clonemap::iterator x = local_clones.find(user->GetCIDRMask());
- if (x != local_clones.end())
+ if (IS_LOCAL(user))
{
- x->second--;
- if (!x->second)
+ clonemap::iterator x = local_clones.find(user->GetCIDRMask());
+ if (x != local_clones.end())
{
- local_clones.erase(x);
+ x->second--;
+ if (!x->second)
+ {
+ local_clones.erase(x);
+ }
}
}