+Module* ServerConfig::GetIOHook(int port)
+{
+ std::map<int,Module*>::iterator x = IOHookModule.find(port);
+ return (x != IOHookModule.end() ? x->second : NULL);
+}
+
+bool ServerConfig::AddIOHook(int port, Module* iomod)
+{
+ if (!GetIOHook(port))
+ {
+ IOHookModule[port] = iomod;
+ return true;
+ }
+ else
+ {
+ ModuleException err("Port already hooked by another module");
+ throw(err);
+ return false;
+ }
+}
+
+bool ServerConfig::DelIOHook(int port)
+{
+ std::map<int,Module*>::iterator x = IOHookModule.find(port);
+ if (x != IOHookModule.end())
+ {
+ IOHookModule.erase(x);
+ return true;
+ }
+ return false;
+}
+
+bool ServerConfig::CheckOnce(char* tag, bool bail, userrec* user)
+{
+ int count = ConfValueEnum(tag,&Config->config_f);
+ if (count > 1)
+ {
+ if (bail)
+ {
+ printf("There were errors in your configuration:\nYou have more than one <%s> tag, this is not permitted.\n",tag);
+ Exit(0);
+ }
+ else
+ {
+ if (user)
+ {
+ WriteServ(user->fd,"There were errors in your configuration:");
+ WriteServ(user->fd,"You have more than one <%s> tag, this is not permitted.\n",tag);
+ }
+ else
+ {
+ WriteOpers("There were errors in the configuration file:");
+ WriteOpers("You have more than one <%s> tag, this is not permitted.\n",tag);
+ }
+ }
+ return false;
+ }
+ if (count < 1)
+ {
+ if (bail)
+ {
+ printf("There were errors in your configuration:\nYou have not defined a <%s> tag, this is required.\n",tag);
+ Exit(0);
+ }
+ else
+ {
+ if (user)
+ {
+ WriteServ(user->fd,"There were errors in your configuration:");
+ WriteServ(user->fd,"You have not defined a <%s> tag, this is required.",tag);
+ }
+ else
+ {
+ WriteOpers("There were errors in the configuration file:");
+ WriteOpers("You have not defined a <%s> tag, this is required.",tag);
+ }
+ }
+ return false;
+ }
+ return true;
+}