* | 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
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*) { }
-void Module::OnUserJoin(User*, Channel*, bool&) { }
+void Module::OnUserJoin(User*, Channel*, bool, bool&) { }
void Module::OnPostJoin(User*, Channel*) { }
void Module::OnUserPart(User*, Channel*, const std::string&, bool&) { }
void Module::OnRehash(User*, const std::string&) { }
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::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; }
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; }
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*) { }
ModuleManager::ModuleManager(InspIRCd* Ins) : ModCount(0), Instance(Ins)
{
- for (int n = I_BEGIN; n != I_END; ++n)
- EventHandlers.push_back(std::vector<Module*>());
}
ModuleManager::~ModuleManager()
newhandle = new ircd_module(Instance, modfile, "init_module");
newmod = newhandle->CallInit();
- if(newmod)
+ if (newmod)
{
Version v = newmod->GetVersion();
if (v.API != API_VERSION)
{
+ DetachAll(newmod);
delete newmod;
+ delete newhandle;
LastModuleError = "Unable to load " + filename_str + ": Incorrect module API version: " + ConvToStr(v.API) + " (our version: " + ConvToStr(API_VERSION) + ")";
Instance->Log(DEFAULT, LastModuleError);
return false;
}
else
{
+ delete newhandle;
LastModuleError = "Unable to load " + filename_str + ": Probably missing init_module() entrypoint, but dlsym() didn't notice a problem";
Instance->Log(DEFAULT, LastModuleError);
return false;
}
}
+ /** XXX: Is there anything we can do about this mess? -- Brain */
catch (LoadModuleException& modexcept)
{
+ DetachAll(newmod);
+ if (newmod)
+ delete newmod;
+ if (newhandle)
+ delete newhandle;
LastModuleError = "Unable to load " + filename_str + ": Error when loading: " + modexcept.GetReason();
Instance->Log(DEFAULT, LastModuleError);
return false;
}
catch (FindSymbolException& modexcept)
{
+ DetachAll(newmod);
+ if (newmod)
+ delete newmod;
+ if (newhandle)
+ delete newhandle;
LastModuleError = "Unable to load " + filename_str + ": Error finding symbol: " + modexcept.GetReason();
Instance->Log(DEFAULT, LastModuleError);
return false;
}
catch (CoreException& modexcept)
{
+ DetachAll(newmod);
+ if (newmod)
+ delete newmod;
+ if (newhandle)
+ delete newhandle;
LastModuleError = "Unable to load " + filename_str + ": " + modexcept.GetReason();
Instance->Log(DEFAULT, LastModuleError);
return false;
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)
return reinterpret_cast<User*>(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)
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;
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;
}