- unsigned int old_fd = user->GetFd();
- user->Write("ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,message.c_str());
- user->FlushWriteBuf();
- user->ClearBuffer();
- user->SetFd(FD_MAGIC_NUMBER);
-
- if (find(local_users.begin(),local_users.end(),user) != local_users.end())
- {
- local_users.erase(find(local_users.begin(),local_users.end(),user));
- }
-
- this->SE->DelFd(user);
- shutdown(old_fd,2);
- close(old_fd);
- return true;
-}
-
-bool InspIRCd::PseudoToUser(userrec* alive, userrec* zombie, const std::string &message)
-{
- zombie->SetFd(alive->GetFd());
- FOREACH_MOD_I(this,I_OnUserQuit,OnUserQuit(alive,message));
- alive->SetFd(FD_MAGIC_NUMBER);
- alive->FlushWriteBuf();
- alive->ClearBuffer();
- // save these for later
- std::string oldnick = alive->nick;
- std::string oldhost = alive->host;
- std::string oldident = alive->ident;
- userrec::QuitUser(this,alive,message.c_str());
- if (find(local_users.begin(),local_users.end(),alive) != local_users.end())
- {
- local_users.erase(find(local_users.begin(),local_users.end(),alive));
- }
- // Fix by brain - cant write the user until their fd table entry is updated
- zombie->Write(":%s!%s@%s NICK %s",oldnick.c_str(),oldident.c_str(),oldhost.c_str(),zombie->nick);
- for (UCListIter i = zombie->chans.begin(); i != zombie->chans.end(); i++)