diff options
-rw-r--r-- | src/inspircd.cpp | 6 | ||||
-rw-r--r-- | src/modules.cpp | 2 | ||||
-rw-r--r-- | src/userprocess.cpp | 33 |
3 files changed, 27 insertions, 14 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 83f5948fb..b564ec396 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -75,6 +75,7 @@ extern int MODCOUNT; int openSockfd[MAXSOCKS]; sockaddr_in client,server; socklen_t length; +extern Module* IOHookModule; extern InspSocket* socket_ref[65535]; @@ -1184,7 +1185,10 @@ int InspIRCd::Run() */ if (incomingSockfd >= 0) { - FOREACH_MOD OnRawSocketAccept(incomingSockfd, target, in_port); + if (IOHookModule) + { + IOHookModule->OnRawSocketAccept(incomingSockfd, target, in_port); + } stats->statsAccept++; AddClient(incomingSockfd, target, in_port, false, target); log(DEBUG,"Adding client on port %lu fd=%lu",(unsigned long)in_port,(unsigned long)incomingSockfd); diff --git a/src/modules.cpp b/src/modules.cpp index c2fa1a036..a5404038b 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -67,7 +67,7 @@ extern chan_hash chanlist; extern command_table cmdlist; ExtModeList EMode; -Module* IOHookModule; +Module* IOHookModule = NULL; // returns true if an extended mode character is in use bool ModeDefined(char modechar, int type) diff --git a/src/userprocess.cpp b/src/userprocess.cpp index b5a5b6683..f8d7218cf 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -79,22 +79,31 @@ char data[65536]; extern user_hash clientlist; extern chan_hash chanlist; +extern Module* IOHookModule; + void ProcessUser(userrec* cu) { int result = EAGAIN; log(DEBUG,"Processing user with fd %d",cu->fd); - int MOD_RESULT = 0; - int result2 = 0; - FOREACH_RESULT(OnRawSocketRead(cu->fd,data,65535,result2)); - if (!MOD_RESULT) - { - result = cu->ReadData(data, 65535); - } - else - { - log(DEBUG,"Data result returned by module: %d",MOD_RESULT); - result = result2; - } + if (IOHookModule) + { + int MOD_RESULT = 0; + int result2 = 0; + IOHookModule->OnRawSocketRead(cu->fd,data,65535,result2); + if (!MOD_RESULT) + { + result = cu->ReadData(data, 65535); + } + else + { + log(DEBUG,"Data result returned by module: %d",MOD_RESULT); + result = result2; + } + } + else + { + result = cu->ReadData(data, 65535); + } log(DEBUG,"Read result: %d",result); if (result) { |