]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules.cpp
Fix typos
[user/henk/code/inspircd.git] / src / modules.cpp
index b78b84d12d7a155cc7d2fd61b27bce3e3aa488af..fe6db535cc402d10f37e027b64c791c21248f35e 100644 (file)
@@ -169,7 +169,7 @@ void                Module::OnEvent(Event* event) { return; };
 char*          Module::OnRequest(Request* request) { return NULL; };
 int            Module::OnOperCompare(const std::string &password, const std::string &input) { return 0; };
 void           Module::OnGlobalOper(userrec* user) { };
-void           Module::OnGlobalConnect(userrec* user) { };
+void           Module::OnPostConnect(userrec* user) { };
 int            Module::OnAddBan(userrec* source, chanrec* channel,const std::string &banmask) { return 0; };
 int            Module::OnDelBan(userrec* source, chanrec* channel,const std::string &banmask) { return 0; };
 void           Module::OnRawSocketAccept(int fd, const std::string &ip, int localport) { };
@@ -209,25 +209,8 @@ void               Module::OnChannelDelete(chanrec* chan) { };
 Priority       Module::Prioritize() { return PRIORITY_DONTCARE; }
 void           Module::OnSetAway(userrec* user) { };
 void           Module::OnCancelAway(userrec* user) { };
+int            Module::OnUserList(userrec* user, chanrec* Ptr) { return 0; };
 
-/* server is a wrapper class that provides methods to all of the C-style
- * exports in the core
- */
-
-void InspIRCd::AddSocket(InspSocket* sock)
-{
-       this->module_sockets.push_back(sock);
-}
-
-void InspIRCd::RemoveSocket(InspSocket* sock)
-{
-       for (std::vector<InspSocket*>::iterator a = this->module_sockets.begin(); a < this->module_sockets.end(); a++)
-       {
-               InspSocket* s = (InspSocket*)*a;
-               if (s == sock)
-                       s->MarkAsClosed();
-       }
-}
 
 long InspIRCd::PriorityAfter(const std::string &modulename)
 {
@@ -303,18 +286,6 @@ void InspIRCd::RehashServer()
        this->Config->Read(false,NULL);
 }
 
-void InspIRCd::DelSocket(InspSocket* sock)
-{
-       for (std::vector<InspSocket*>::iterator a = this->module_sockets.begin(); a < this->module_sockets.end(); a++)
-       {
-               if (*a == sock)
-               {
-                       this->module_sockets.erase(a);
-                       return;
-               }
-       }
-}
-
 /* This is ugly, yes, but hash_map's arent designed to be
  * addressed in this manner, and this is a bit of a kludge.
  * Luckily its a specialist function and rarely used by
@@ -380,7 +351,7 @@ void InspIRCd::DumpText(userrec* User, const std::string &LinePrefix, stringstre
 
 userrec* InspIRCd::FindDescriptor(int socket)
 {
-       return ((socket < MAX_DESCRIPTORS && socket > -1) ? this->fd_ref_table[socket] : NULL);
+       return reinterpret_cast<userrec*>(this->SE->GetRef(socket));
 }
 
 bool InspIRCd::AddMode(ModeHandler* mh, const unsigned char mode)
@@ -405,18 +376,18 @@ bool InspIRCd::AddResolver(Resolver* r)
 
 bool InspIRCd::UserToPseudo(userrec* user, const std::string &message)
 {
-       unsigned int old_fd = user->fd;
+       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->fd = FD_MAGIC_NUMBER;
+       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(old_fd);
+       this->SE->DelFd(user);
        shutdown(old_fd,2);
        close(old_fd);
        return true;
@@ -424,9 +395,9 @@ bool InspIRCd::UserToPseudo(userrec* user, const std::string &message)
 
 bool InspIRCd::PseudoToUser(userrec* alive, userrec* zombie, const std::string &message)
 {
-       zombie->fd = alive->fd;
+       zombie->SetFd(alive->GetFd());
        FOREACH_MOD_I(this,I_OnUserQuit,OnUserQuit(alive,message));
-       alive->fd = FD_MAGIC_NUMBER;
+       alive->SetFd(FD_MAGIC_NUMBER);
        alive->FlushWriteBuf();
        alive->ClearBuffer();
        // save these for later
@@ -439,7 +410,6 @@ bool InspIRCd::PseudoToUser(userrec* alive, userrec* zombie, const std::string &
                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
-       this->fd_ref_table[zombie->fd] = zombie;
        zombie->Write(":%s!%s@%s NICK %s",oldnick.c_str(),oldident.c_str(),oldhost.c_str(),zombie->nick);
        for (std::vector<ucrec*>::const_iterator i = zombie->chans.begin(); i != zombie->chans.end(); i++)
        {
@@ -456,9 +426,8 @@ bool InspIRCd::PseudoToUser(userrec* alive, userrec* zombie, const std::string &
                                zombie->WriteServ("366 %s %s :End of /NAMES list.", zombie->nick, Ptr->name);
                }
        }
-       if ((find(local_users.begin(),local_users.end(),zombie) == local_users.end()) && (zombie->fd != FD_MAGIC_NUMBER))
+       if ((find(local_users.begin(),local_users.end(),zombie) == local_users.end()) && (zombie->GetFd() != FD_MAGIC_NUMBER))
                local_users.push_back(zombie);
-
        return true;
 }