]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules.cpp
Added helperfuncs.h
[user/henk/code/inspircd.git] / src / modules.cpp
index 3ec932980e9c4b58f3ad9777f4346fa2e8b70df9..7214a9673c8351d1c2125679582a4ba066cfaad0 100644 (file)
@@ -43,6 +43,7 @@
 #include "typedefs.h"
 #include "modules.h"
 #include "command_parse.h"
+#include "dns.h"
 
 extern ServerConfig *Config;
 extern InspIRCd* ServerInstance;
@@ -606,6 +607,11 @@ 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);
@@ -931,6 +937,7 @@ FileReader::FileReader(const std::string &filename)
        file_cache c;
        readfile(c,filename.c_str());
        this->fc = c;
+       this->CalcSize();
 }
 
 FileReader::FileReader()
@@ -942,18 +949,23 @@ std::string FileReader::Contents()
        std::string x = "";
        for (file_cache::iterator a = this->fc.begin(); a != this->fc.end(); a++)
        {
-               x.append(a->c_str());
+               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);
-       return n;
+       this->contentsize = n;
 }
 
 void FileReader::LoadFile(const std::string &filename)
@@ -961,6 +973,7 @@ void FileReader::LoadFile(const std::string &filename)
        file_cache c;
        readfile(c,filename.c_str());
        this->fc = c;
+       this->CalcSize();
 }