]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules.cpp
1) Fix for nickname overruled with new cullList stuff -- we have to change their...
[user/henk/code/inspircd.git] / src / modules.cpp
index a67ebc6dabcc4f92c9ea503d40ef0185554171df..7505dd21edf2fb814a7098446b49abbde4532fd9 100644 (file)
@@ -109,7 +109,7 @@ void                Module::OnUserDisconnect(userrec* user) { }
 void           Module::OnUserJoin(userrec* user, chanrec* channel) { }
 void           Module::OnPostJoin(userrec* user, chanrec* channel) { }
 void           Module::OnUserPart(userrec* user, chanrec* channel, const std::string &partmessage) { }
-void           Module::OnRehash(const std::string &parameter) { }
+void           Module::OnRehash(userrec* user, const std::string &parameter) { }
 void           Module::OnServerRaw(std::string &raw, bool inbound, userrec* user) { }
 int            Module::OnUserPreJoin(userrec* user, chanrec* chan, const char* cname, std::string &privs) { return 0; }
 void           Module::OnMode(userrec* user, void* dest, int target_type, const std::string &text) { };
@@ -348,6 +348,7 @@ void InspIRCd::RehashServer()
        this->WriteOpers("*** Rehashing config file");
        this->RehashUsersAndChans();
        this->Config->Read(false,NULL);
+       this->ResetMaxBans();
        this->Res->Rehash();
 }
 
@@ -434,63 +435,28 @@ bool InspIRCd::DelModeWatcher(ModeWatcher* mw)
        return this->Modes->DelModeWatcher(mw);
 }
 
-bool InspIRCd::AddResolver(Resolver* r)
+bool InspIRCd::AddResolver(Resolver* r, bool cached)
 {
-       return this->Res->AddResolverClass(r);
+       if (!cached)
+               return this->Res->AddResolverClass(r);
+       else
+       {
+               r->TriggerCachedResult();
+               delete r;
+               return true;
+       }
 }
 
 bool InspIRCd::UserToPseudo(userrec* user, const std::string &message)
 {
-       unsigned int old_fd = user->GetFd();
-       user->Write("ERROR :Closing link (%s@%s) [%s]",user->ident,user->host,message.c_str());
-       user->FlushWriteBuf();
-       user->ClearBuffer();
-       user->SetFd(FD_MAGIC_NUMBER);
-
-       if (find(local_users.begin(),local_users.end(),user) != local_users.end())
-       {
-               local_users.erase(find(local_users.begin(),local_users.end(),user));
-       }
-
-       this->SE->DelFd(user);
-       shutdown(old_fd,2);
-       close(old_fd);
-       return true;
+       throw CoreException("The InspIRCd::UsertoPseudo function should not be used in InspIRCd later than 1.0.x");
+       return false;
 }
 
 bool InspIRCd::PseudoToUser(userrec* alive, userrec* zombie, const std::string &message)
 {
-       zombie->SetFd(alive->GetFd());
-       FOREACH_MOD_I(this,I_OnUserQuit,OnUserQuit(alive,message));
-       alive->SetFd(FD_MAGIC_NUMBER);
-       alive->FlushWriteBuf();
-       alive->ClearBuffer();
-       // save these for later
-       std::string oldnick = alive->nick;
-       std::string oldhost = alive->host;
-       std::string oldident = alive->ident;
-       userrec::QuitUser(this,alive,message.c_str());
-       if (find(local_users.begin(),local_users.end(),alive) != local_users.end())
-       {
-               local_users.erase(find(local_users.begin(),local_users.end(),alive));
-       }
-       // Fix by brain - cant write the user until their fd table entry is updated
-       zombie->Write(":%s!%s@%s NICK %s",oldnick.c_str(),oldident.c_str(),oldhost.c_str(),zombie->nick);
-       for (UCListIter i = zombie->chans.begin(); i != zombie->chans.end(); i++)
-       {
-               chanrec* Ptr = i->first;
-               zombie->WriteFrom(zombie,"JOIN %s",Ptr->name);
-               if (Ptr->topicset)
-               {
-                       zombie->WriteServ("332 %s %s :%s", zombie->nick, Ptr->name, Ptr->topic);
-                       zombie->WriteServ("333 %s %s %s %d", zombie->nick, Ptr->name, Ptr->setby, Ptr->topicset);
-               }
-               Ptr->UserList(zombie);
-               zombie->WriteServ("366 %s %s :End of /NAMES list.", zombie->nick, Ptr->name);
-       }
-       if ((find(local_users.begin(),local_users.end(),zombie) == local_users.end()) && (zombie->GetFd() != FD_MAGIC_NUMBER))
-               local_users.push_back(zombie);
-       return true;
+       throw CoreException("The InspIRCd::PseudotoUser function should not be used in InspIRCd later than 1.0.x");
+       return false;
 }
 
 void InspIRCd::AddGLine(long duration, const std::string &source, const std::string &reason, const std::string &hostmask)
@@ -710,10 +676,7 @@ bool ConfigReader::Verify()
 
 FileReader::FileReader(InspIRCd* Instance, const std::string &filename) : ServerInstance(Instance)
 {
-       file_cache c;
-       ServerInstance->Config->ReadFile(c,filename.c_str());
-       this->fc = c;
-       this->CalcSize();
+       LoadFile(filename);
 }
 
 FileReader::FileReader(InspIRCd* Instance) : ServerInstance(Instance)
@@ -747,9 +710,12 @@ void FileReader::CalcSize()
 void FileReader::LoadFile(const std::string &filename)
 {
        file_cache c;
-       ServerInstance->Config->ReadFile(c,filename.c_str());
-       this->fc = c;
-       this->CalcSize();
+       c.clear();
+       if (ServerInstance->Config->ReadFile(c,filename.c_str()))
+       {
+               this->fc = c;
+               this->CalcSize();
+       }
 }