diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-12-09 18:36:24 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-12-09 18:36:24 +0000 |
commit | dfa831752c950f16872f3c485f94d408866a2e15 (patch) | |
tree | b99e6837deeca18597eb4530bb7ccf3cf96e20ad /src/configreader.cpp | |
parent | f4be97d195f206433c1b0a986959e75c01da1b20 (diff) |
Not yet tested -- allow iohooking of inspsockets
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5886 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/configreader.cpp')
-rw-r--r-- | src/configreader.cpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp index 73a0e25b1..f7c867544 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -57,6 +57,12 @@ Module* ServerConfig::GetIOHook(int port) return (x != IOHookModule.end() ? x->second : NULL); } +Module* ServerConfig::GetIOHook(InspSocket* is) +{ + std::map<InspSocket*,Module*>::iterator x = SocketIOHookModule.find(is); + return (x != SocketIOHookModule.end() ? x->second : NULL); +} + bool ServerConfig::AddIOHook(int port, Module* iomod) { if (!GetIOHook(port)) @@ -66,8 +72,22 @@ bool ServerConfig::AddIOHook(int port, Module* iomod) } else { - ModuleException err("Port already hooked by another module"); - throw(err); + throw ModuleException("Port already hooked by another module"); + return false; + } +} + +bool ServerConfig::AddIOHook(InspSocket* is, Module* iomod) +{ + if (!GetIOHook(is)) + { + SocketIOHookModule[is] = iomod; + is->IsIOHooked = true; + return true; + } + else + { + throw ModuleException("InspSocket derived class already hooked by another module"); return false; } } @@ -83,6 +103,17 @@ bool ServerConfig::DelIOHook(int port) return false; } +bool ServerConfig::DelIOHook(InspSocket* is) +{ + std::map<InspSocket*,Module*>::iterator x = SocketIOHookModule.find(is); + if (x != SocketIOHookModule.end()) + { + SocketIOHookModule.erase(x); + return true; + } + return false; +} + bool ServerConfig::CheckOnce(char* tag, bool bail, userrec* user) { int count = ConfValueEnum(this->config_data, tag); |