]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules.cpp
Allow opermotd to specify its file in <files> without also requiring an <opermotd...
[user/henk/code/inspircd.git] / src / modules.cpp
index 529e88b07220e6aceb9e05573b9a3a904396a19a..52a25d37cc8e0a43001776e402675eaf450364a1 100644 (file)
@@ -155,13 +155,14 @@ ModResult Module::OnUserList(User*, Channel*) { return MOD_RES_PASSTHRU; }
 ModResult      Module::OnWhoisLine(User*, User*, int&, std::string&) { return MOD_RES_PASSTHRU; }
 void           Module::OnBuildNeighborList(User*, UserChanList&, std::map<User*,bool>&) { }
 void           Module::OnGarbageCollect() { }
+ModResult      Module::OnSetConnectClass(LocalUser* user, ConnectClass* myclass) { return MOD_RES_PASSTHRU; }
 void           Module::OnText(User*, void*, int, const std::string&, char, CUList&) { }
 void           Module::OnRunTestSuite() { }
 void           Module::OnNamesListItem(User*, Membership*, std::string&, std::string&) { }
 ModResult      Module::OnNumeric(User*, unsigned int, const std::string&) { return MOD_RES_PASSTHRU; }
 void           Module::OnHookIO(StreamSocket*, ListenSocket*) { }
 ModResult   Module::OnAcceptConnection(int, ListenSocket*, irc::sockets::sockaddrs*, irc::sockets::sockaddrs*) { return MOD_RES_PASSTHRU; }
-void           Module::OnSendWhoLine(User*, User*, Channel*, std::string&) { }
+void           Module::OnSendWhoLine(User*, const std::vector<std::string>&, User*, Channel*, std::string&) { }
 ModResult      Module::OnChannelRestrictionApply(User*, Channel*, const char*) { return MOD_RES_PASSTHRU; }
 
 ModuleManager::ModuleManager() : ModCount(0)
@@ -524,6 +525,14 @@ void InspIRCd::SendMode(const std::vector<std::string>& parameters, User *user)
        this->Modes->Process(parameters, user);
 }
 
+
+void InspIRCd::SendGlobalMode(const std::vector<std::string>& parameters, User *user)
+{
+       Modes->Process(parameters, user);
+       if (!Modes->GetLastParse().empty())
+               this->PI->SendMode(parameters[0], Modes->GetLastParseParams(), Modes->GetLastParseTranslate());
+}
+
 bool InspIRCd::AddResolver(Resolver* r, bool cached)
 {
        if (!cached)
@@ -677,13 +686,27 @@ void FileReader::CalcSize()
 
 void FileReader::LoadFile(const std::string &filename)
 {
-       file_cache c;
-       c.clear();
-       if (ServerInstance->Config->ReadFile(c,filename.c_str()))
+       std::map<std::string, file_cache>::iterator file = ServerInstance->Config->Files.find(filename);
+       if (file != ServerInstance->Config->Files.end())
+       {
+               this->fc = file->second;
+       }
+       else
        {
-               this->fc = c;
-               this->CalcSize();
+               fc.clear();
+               FILE* f = fopen(filename.c_str(), "r");
+               if (!f)
+                       return;
+               char linebuf[MAXBUF*10];
+               while (fgets(linebuf, sizeof(linebuf), f))
+               {
+                       int len = strlen(linebuf);
+                       if (len)
+                               fc.push_back(std::string(linebuf, len - 1));
+               }
+               fclose(f);
        }
+       CalcSize();
 }