]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/helperfuncs.cpp
Removed debug
[user/henk/code/inspircd.git] / src / helperfuncs.cpp
index 3e188ee88f33ed8c9d8dd50f3effc9f59dc57e20..037a7a3af9d01aeae99347675ae230d7a7cce3f1 100644 (file)
@@ -52,16 +52,15 @@ using namespace std;
 extern int MODCOUNT;
 extern std::vector<Module*> modules;
 extern ServerConfig *Config;
+extern InspIRCd* ServerInstance;
 extern time_t TIME;
 extern char lowermap[255];
 static char list[MAXBUF];
 extern userrec* fd_ref_table[65536];
-extern serverstats* stats;
 static char already_sent[65536];
 extern std::vector<userrec*> all_opers;
 extern user_hash clientlist;
 extern chan_hash chanlist;
-extern Module* IOHookModule;
 
 void log(int level,char *text, ...)
 {
@@ -140,15 +139,15 @@ void Write(int sock,char *text, ...)
         chop(tb);
         if (fd_ref_table[sock])
         {
-               if (IOHookModule)
+               if (Config->GetIOHook(fd_ref_table[sock]->port))
                {
-                       IOHookModule->OnRawSocketWrite(sock,tb,bytes);
+                       Config->GetIOHook(fd_ref_table[sock]->port)->OnRawSocketWrite(sock,tb,bytes);
                }
                else
                {
                        fd_ref_table[sock]->AddWriteBuf(tb);
                }
-               stats->statsSent += bytes;
+               ServerInstance->stats->statsSent += bytes;
         }
         else log(DEFAULT,"ERROR! attempted write to a user with no fd_ref_table entry!!!");
 }
@@ -173,15 +172,15 @@ void WriteServ(int sock, char* text, ...)
         chop(tb);
         if (fd_ref_table[sock])
         {
-               if (IOHookModule)
+               if (Config->GetIOHook(fd_ref_table[sock]->port))
                {
-                       IOHookModule->OnRawSocketWrite(sock,tb,bytes);
+                       Config->GetIOHook(fd_ref_table[sock]->port)->OnRawSocketWrite(sock,tb,bytes);
                }
                else
                {
                        fd_ref_table[sock]->AddWriteBuf(tb);
                }
-                stats->statsSent += bytes;
+                ServerInstance->stats->statsSent += bytes;
         }
         else log(DEFAULT,"ERROR! attempted write to a user with no fd_ref_table entry!!!");
 }
@@ -206,15 +205,15 @@ void WriteFrom(int sock, userrec *user,char* text, ...)
         chop(tb);
         if (fd_ref_table[sock])
         {
-               if (IOHookModule)
+               if (Config->GetIOHook(fd_ref_table[sock]->port))
                {
-                       IOHookModule->OnRawSocketWrite(sock,tb,bytes);
+                       Config->GetIOHook(fd_ref_table[sock]->port)->OnRawSocketWrite(sock,tb,bytes);
                }
                else
                {
                        fd_ref_table[sock]->AddWriteBuf(tb);
                }
-                stats->statsSent += bytes;
+                ServerInstance->stats->statsSent += bytes;
         }
         else log(DEFAULT,"ERROR! attempted write to a user with no fd_ref_table entry!!!");
 }
@@ -1065,15 +1064,15 @@ void ShowMOTD(userrec *user)
         snprintf(mbuf,MAXBUF,":%s 376 %s :End of message of the day.\r\n", Config->ServerName, user->nick);
         WholeMOTD = WholeMOTD + mbuf;
         // only one write operation
-       if (IOHookModule)
+       if (Config->GetIOHook(user->port))
        {
-               IOHookModule->OnRawSocketWrite(user->fd,(char*)WholeMOTD.c_str(),WholeMOTD.length());
+               Config->GetIOHook(user->port)->OnRawSocketWrite(user->fd,(char*)WholeMOTD.c_str(),WholeMOTD.length());
        }
        else
        {
                user->AddWriteBuf(WholeMOTD);
        }
-        stats->statsSent += WholeMOTD.length();
+        ServerInstance->stats->statsSent += WholeMOTD.length();
 }
 
 void ShowRULES(userrec *user)