#include "typedefs.h"
#include "modules.h"
#include "command_parse.h"
+#include "dns.h"
extern ServerConfig *Config;
extern InspIRCd* ServerInstance;
return iter->second;
}
-const char* Server::GetModuleName(Module* m)
+const std::string& Server::GetModuleName(Module* m)
{
+ static std::string nothing = ""; /* Prevent compiler warning */
for (int i = 0; i <= MODCOUNT; i++)
{
if (modules[i] == m)
{
- return module_names[i];
+ return Config->module_names[i];
}
}
- return "";
+ return nothing; /* As above */
}
void Server::RehashServer()
return ServerInstance->ModeGrok->AddMode(mh,mode);
}
+bool Server::AddModeWatcher(ModeWatcher* mw)
+{
+ return ServerInstance->ModeGrok->AddModeWatcher(mw);
+}
+
+bool Server::DelModeWatcher(ModeWatcher* mw)
+{
+ return ServerInstance->ModeGrok->DelModeWatcher(mw);
+}
+
+bool Server::AddResolver(Resolver* r)
+{
+ return dns_add_class(r);
+}
+
int Server::CountUsers(chanrec* c)
{
return usercount(c);
file_cache c;
readfile(c,filename.c_str());
this->fc = c;
+ this->CalcSize();
}
FileReader::FileReader()
{
}
+std::string FileReader::Contents()
+{
+ std::string x = "";
+ for (file_cache::iterator a = this->fc.begin(); a != this->fc.end(); a++)
+ {
+ x.append(*a);
+ x.append("\r\n");
+ }
+ return x;
+}
+
+unsigned long FileReader::ContentSize()
+{
+ return this->contentsize;
+}
+
+void FileReader::CalcSize()
+{
+ unsigned long n = 0;
+ for (file_cache::iterator a = this->fc.begin(); a != this->fc.end(); a++)
+ n += (a->length() + 2);
+ this->contentsize = n;
+}
+
void FileReader::LoadFile(const std::string &filename)
{
file_cache c;
readfile(c,filename.c_str());
this->fc = c;
+ this->CalcSize();
}