summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/helperfuncs.cpp45
-rw-r--r--src/modules.cpp3
2 files changed, 37 insertions, 11 deletions
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index c886acf3c..3f7e89d57 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -62,6 +62,7 @@ extern std::vector<userrec*> all_opers;
extern user_hash clientlist;
extern chan_hash chanlist;
extern command_table cmdlist;
+extern Module* IOHookModule;
static char textbuffer[MAXBUF];
static char tb[MAXBUF];
@@ -143,10 +144,15 @@ void Write(int sock,char *text, ...)
chop(tb);
if (fd_ref_table[sock])
{
- int MOD_RESULT = 0;
- FOREACH_RESULT(OnRawSocketWrite(sock,tb,bytes));
- fd_ref_table[sock]->AddWriteBuf(tb);
- stats->statsSent += bytes;
+ if (IOHookModule)
+ {
+ IOHookModule->OnRawSocketWrite(sock,tb,bytes);
+ }
+ else
+ {
+ fd_ref_table[sock]->AddWriteBuf(tb);
+ }
+ stats->statsSent += bytes;
}
else log(DEFAULT,"ERROR! attempted write to a user with no fd_ref_table entry!!!");
}
@@ -171,9 +177,14 @@ void WriteServ(int sock, char* text, ...)
chop(tb);
if (fd_ref_table[sock])
{
- int MOD_RESULT = 0;
- FOREACH_RESULT(OnRawSocketWrite(sock,tb,bytes));
- fd_ref_table[sock]->AddWriteBuf(tb);
+ if (IOHookModule)
+ {
+ IOHookModule->OnRawSocketWrite(sock,tb,bytes);
+ }
+ else
+ {
+ fd_ref_table[sock]->AddWriteBuf(tb);
+ }
stats->statsSent += bytes;
}
else log(DEFAULT,"ERROR! attempted write to a user with no fd_ref_table entry!!!");
@@ -199,9 +210,14 @@ void WriteFrom(int sock, userrec *user,char* text, ...)
chop(tb);
if (fd_ref_table[sock])
{
- int MOD_RESULT = 0;
- FOREACH_RESULT(OnRawSocketWrite(sock,tb,bytes));
- fd_ref_table[sock]->AddWriteBuf(tb);
+ if (IOHookModule)
+ {
+ IOHookModule->OnRawSocketWrite(sock,tb,bytes);
+ }
+ else
+ {
+ fd_ref_table[sock]->AddWriteBuf(tb);
+ }
stats->statsSent += bytes;
}
else log(DEFAULT,"ERROR! attempted write to a user with no fd_ref_table entry!!!");
@@ -1052,7 +1068,14 @@ 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
- user->AddWriteBuf(WholeMOTD);
+ if (IOHookModule)
+ {
+ IOHookModule->OnRawSocketWrite(user->fd,(char*)WholeMOTD.c_str(),WholeMOTD.length());
+ }
+ else
+ {
+ user->AddWriteBuf(WholeMOTD);
+ }
stats->statsSent += WholeMOTD.length();
}
diff --git a/src/modules.cpp b/src/modules.cpp
index b58964b57..c2fa1a036 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -48,6 +48,7 @@ using namespace std;
#include "socket.h"
#include "socketengine.h"
#include "typedefs.h"
+#include "modules.h"
extern SocketEngine* SE;
extern ServerConfig *Config;
@@ -66,6 +67,8 @@ extern chan_hash chanlist;
extern command_table cmdlist;
ExtModeList EMode;
+Module* IOHookModule;
+
// returns true if an extended mode character is in use
bool ModeDefined(char modechar, int type)
{