X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules.cpp;h=64b560d892a63752c050236177e32bf7cacbcbb9;hb=af7e1a1ca8b36064593becf62b1a91468ad32237;hp=8f32e94acc541054fd1b19fb1713c64fcd6daa70;hpb=b94c45340e153254f9dd06ecc3445222f31d0220;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules.cpp b/src/modules.cpp index 8f32e94ac..64b560d89 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * InspIRCd: (C) 2002-2008 InspIRCd Development Team * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see @@ -106,6 +106,8 @@ std::string Event::GetEventID() Module::Module(InspIRCd* Me) : ServerInstance(Me) { } Module::~Module() { } +void Module::OnReadConfig(ServerConfig*, ConfigReader*) { } +int Module::OnDownloadFile(const std::string&, std::istream*&) { return 0; } void Module::OnUserConnect(User*) { } void Module::OnUserQuit(User*, const std::string&, const std::string&) { } void Module::OnUserDisconnect(User*) { } @@ -118,10 +120,10 @@ int Module::OnUserPreJoin(User*, Channel*, const char*, std::string&) { return void Module::OnMode(User*, void*, int, const std::string&) { } Version Module::GetVersion() { return Version(1,0,0,0,VF_VENDOR,-1); } void Module::OnOper(User*, const std::string&) { } -void Module::OnPostOper(User*, const std::string&) { } +void Module::OnPostOper(User*, const std::string&, const std::string &) { } void Module::OnInfo(User*) { } void Module::OnWhois(User*, User*) { } -int Module::OnUserPreInvite(User*, User*, Channel*) { return 0; } +int Module::OnUserPreInvite(User*, User*, Channel*, time_t) { return 0; } int Module::OnUserPreMessage(User*, void*, int, std::string&, char, CUList&) { return 0; } int Module::OnUserPreNotice(User*, void*, int, std::string&, char, CUList&) { return 0; } int Module::OnUserPreNick(User*, const std::string&) { return 0; } @@ -138,6 +140,7 @@ bool Module::OnCheckReady(User*) { return true; } int Module::OnUserRegister(User*) { return 0; } int Module::OnUserPreKick(User*, User*, Channel*, const std::string&) { return 0; } void Module::OnUserKick(User*, User*, Channel*, const std::string&, bool&) { } +int Module::OnRawMode(User*, Channel*, const char, const std::string &, bool, int) { return 0; } int Module::OnCheckInvite(User*, Channel*) { return 0; } int Module::OnCheckKey(User*, Channel*, const std::string&) { return 0; } int Module::OnCheckLimit(User*, Channel*) { return 0; } @@ -148,7 +151,7 @@ int Module::OnChangeLocalUserGECOS(User*, const std::string&) { return 0; } int Module::OnLocalTopicChange(User*, Channel*, const std::string&) { return 0; } void Module::OnEvent(Event*) { return; } char* Module::OnRequest(Request*) { return NULL; } -int Module::OnOperCompare(const std::string&, const std::string&, int) { return 0; } +int Module::OnPassCompare(Extensible* ex, const std::string &password, const std::string &input, const std::string& hashtype) { return 0; } void Module::OnGlobalOper(User*) { } void Module::OnPostConnect(User*) { } int Module::OnAddBan(User*, Channel*, const std::string &) { return 0; } @@ -161,7 +164,7 @@ int Module::OnRawSocketRead(int, char*, unsigned int, int&) { return 0; } void Module::OnUserMessage(User*, void*, int, const std::string&, char, const CUList&) { } void Module::OnUserNotice(User*, void*, int, const std::string&, char, const CUList&) { } void Module::OnRemoteKill(User*, User*, const std::string&, const std::string&) { } -void Module::OnUserInvite(User*, User*, Channel*) { } +void Module::OnUserInvite(User*, User*, Channel*, time_t) { } void Module::OnPostLocalTopicChange(User*, Channel*, const std::string&) { } void Module::OnGetServerDescription(const std::string&, std::string&) { } void Module::OnSyncUser(User*, Module*, void*) { } @@ -177,7 +180,9 @@ void Module::OnChangeHost(User*, const std::string&) { } void Module::OnChangeName(User*, const std::string&) { } void Module::OnAddLine(User*, XLine*) { } void Module::OnDelLine(User*, XLine*) { } +void Module::OnExpireLine(XLine*) { } void Module::OnCleanup(int, void*) { } +int Module::OnChannelPreDelete(Channel*) { return 0; } void Module::OnChannelDelete(Channel*) { } void Module::OnSetAway(User*) { } void Module::OnCancelAway(User*) { } @@ -507,7 +512,7 @@ bool ModuleManager::Unload(const char* filename) { modfind->second.second->OnCleanup(TYPE_CHANNEL,c->second); } - for (user_hash::iterator u = Instance->clientlist->begin(); u != Instance->clientlist->end(); u++) + for (user_hash::iterator u = Instance->Users->clientlist->begin(); u != Instance->Users->clientlist->end(); u++) { modfind->second.second->OnCleanup(TYPE_USER,u->second); } @@ -555,8 +560,6 @@ void ModuleManager::LoadAll() Instance->Exit(EXIT_STATUS_MODULE); } } - printf_c("\nA total of \033[1;32m%d\033[0m module%s been loaded.\n", (this->GetCount()), (this->GetCount()) == 1 ? " has" : "s have"); - Instance->Log(DEFAULT,"Total loaded modules: %d", this->GetCount()); } bool ModuleManager::PublishFeature(const std::string &FeatureName, Module* Mod) @@ -638,6 +641,19 @@ modulelist* ModuleManager::FindInterface(const std::string &InterfaceName) return &(iter->second.second); } +bool ModuleManager::ModuleHasInterface(Module* mod, const std::string& InterfaceName) +{ + interfacelist::iterator iter = Interfaces.find(InterfaceName); + if (iter == Interfaces.end()) + return false; + else + { + modulelist& ml = iter->second.second; + modulelist::iterator mi = std::find(ml.begin(), ml.end(), mod); + return (mi != ml.end()); + } +} + void ModuleManager::UseInterface(const std::string &InterfaceName) { interfacelist::iterator iter = Interfaces.find(InterfaceName); @@ -728,7 +744,7 @@ void InspIRCd::SendMode(const char** parameters, int pcnt, User *user) this->Modes->Process(parameters,pcnt,user,true); } -void InspIRCd::DumpText(User* User, const std::string &LinePrefix, stringstream &TextStream) +void InspIRCd::DumpText(User* User, const std::string &LinePrefix, std::stringstream &TextStream) { std::string CompleteLine = LinePrefix; std::string Word; @@ -749,21 +765,6 @@ User* FindDescriptorHandler::Call(int socket) return reinterpret_cast(Server->SE->GetRef(socket)); } -bool InspIRCd::AddMode(ModeHandler* mh) -{ - return this->Modes->AddMode(mh); -} - -bool InspIRCd::AddModeWatcher(ModeWatcher* mw) -{ - return this->Modes->AddModeWatcher(mw); -} - -bool InspIRCd::DelModeWatcher(ModeWatcher* mw) -{ - return this->Modes->DelModeWatcher(mw); -} - bool InspIRCd::AddResolver(Resolver* r, bool cached) { if (!cached) @@ -797,10 +798,6 @@ const std::vector ModuleManager::GetAllModuleNames(int filter) ConfigReader::ConfigReader(InspIRCd* Instance) : ServerInstance(Instance) { - /* Is there any reason to load the entire config file again here? - * it's needed if they specify another config file, but using the - * default one we can just use the global config data - pre-parsed! - */ this->errorlog = new std::ostringstream(std::stringstream::in | std::stringstream::out); this->error = CONF_NO_ERROR; this->data = &ServerInstance->Config->config_data; @@ -825,7 +822,11 @@ ConfigReader::ConfigReader(InspIRCd* Instance, const std::string &filename) : Se this->data = new ConfigDataHash; this->privatehash = true; this->errorlog = new std::ostringstream(std::stringstream::in | std::stringstream::out); - this->readerror = ServerInstance->Config->LoadConf(*this->data, filename, *this->errorlog); + for (int pass = 0; pass < 2; pass++) + { + /*** XXX: Can return a 'not ready yet!' code! */ + this->readerror = ServerInstance->Config->LoadConf(*this->data, filename, *this->errorlog, pass); + } if (!this->readerror) this->error = CONF_FILE_NOT_FOUND; }