diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-01-09 00:29:36 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-01-09 00:29:36 +0000 |
commit | 69c6384ee924bf47550cfd680234bfc7ffeecc2c (patch) | |
tree | a41c16f2d0e78661003ff55629da30a1203a766b /src | |
parent | c039ac13e29beabd84f884f3cc4530705330c4c4 (diff) |
More usertopseudo fixes
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2742 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/modules.cpp b/src/modules.cpp index ca9808ef5..efd4a5f06 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -57,6 +57,7 @@ extern int MODCOUNT; extern std::vector<Module*> modules; extern std::vector<ircd_module*> factory; extern std::vector<InspSocket*> module_sockets; +extern std::vector<userrec*> local_users; extern time_t TIME; class Server; extern userrec* fd_ref_table[65536]; @@ -602,6 +603,13 @@ bool Server::UserToPseudo(userrec* user,std::string message) user->FlushWriteBuf(); user->ClearBuffer(); user->fd = 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)); + log(DEBUG,"Delete local user"); + } + ServerInstance->SE->DelFd(old_fd); shutdown(old_fd,2); close(old_fd); @@ -610,12 +618,20 @@ bool Server::UserToPseudo(userrec* user,std::string message) bool Server::PseudoToUser(userrec* alive,userrec* zombie,std::string message) { + log(DEBUG,"PseudoToUser"); zombie->fd = alive->fd; alive->fd = FD_MAGIC_NUMBER; alive->FlushWriteBuf(); alive->ClearBuffer(); Write(zombie->fd,":%s!%s@%s NICK %s",alive->nick,alive->ident,alive->host,zombie->nick); kill_link(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)); + log(DEBUG,"Delete local user"); + } + fd_ref_table[zombie->fd] = zombie; for (unsigned int i = 0; i < zombie->chans.size(); i++) { @@ -636,6 +652,9 @@ bool Server::PseudoToUser(userrec* alive,userrec* zombie,std::string message) } } } + if (find(local_users.begin(),local_users.end(),zombie) == local_users.end()) + local_users.push_back(zombie); + return true; } |