]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/configreader.cpp
Remove unused debug
[user/henk/code/inspircd.git] / src / configreader.cpp
index eba798a564a38752a66692178b6c19af8afc78e5..b0106eb5edf465147a8efe13b16a49cbdb4b7f7c 100644 (file)
@@ -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,23 @@ 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(Module* iomod, InspSocket* is)
+{
+       if (!GetIOHook(is))
+       {
+               ServerInstance->Log(DEBUG,"Hooked inspsocket %08x", is);
+               SocketIOHookModule[is] = iomod;
+               is->IsIOHooked = true;
+               return true;
+       }
+       else
+       {
+               throw ModuleException("InspSocket derived class already hooked by another module");
                return false;
        }
 }
@@ -83,6 +104,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);
@@ -308,17 +340,6 @@ bool ValidateRules(ServerConfig* conf, const char* tag, const char* value, Value
        return true;
 }
 
-bool ValidateDie(ServerConfig* conf, const char* tag, const char* value, ValueItem &data)
-{
-       if (!*data.GetString())
-       {
-               conf->GetInstance()->Log(DEFAULT,"Die value is set: \"%s\", terminating.", data.GetString());
-               printf("\n\nERROR: %s\n\n", data.GetString());
-               exit(ERROR);
-       }
-       return true;
-}
-
 bool ValidateWhoWas(ServerConfig* conf, const char* tag, const char* value, ValueItem &data)
 {
        conf->WhoWasMaxKeep = conf->GetInstance()->Duration(data.GetString());
@@ -575,7 +596,7 @@ void ServerConfig::Read(bool bail, userrec* user)
                {"whowas",              "groupsize",                    new ValueContainerInt  (&this->WhoWasGroupSize),        DT_INTEGER, NoValidation},
                {"whowas",              "maxgroups",                    new ValueContainerInt  (&this->WhoWasMaxGroups),        DT_INTEGER, NoValidation},
                {"whowas",              "maxkeep",                      new ValueContainerChar (maxkeep),                       DT_CHARPTR, ValidateWhoWas},
-               {"die",                 "value",                        new ValueContainerChar (this->DieValue),                DT_CHARPTR, ValidateDie},
+               {"die",                 "value",                        new ValueContainerChar (this->DieValue),                DT_CHARPTR, NoValidation},
                {NULL}
        };