diff options
136 files changed, 115 insertions, 601 deletions
diff --git a/include/modules.h b/include/modules.h index 52e41a1fc..710a39193 100644 --- a/include/modules.h +++ b/include/modules.h @@ -122,12 +122,10 @@ struct ModResult { * 'FOREACH_MOD(OnConnect,(user));' */ #define FOREACH_MOD(y,x) do { \ - EventHandlerIter safei; \ - IntModuleList& _handlers = ServerInstance->Modules->EventHandlers[I_ ## y]; \ - for (EventHandlerIter _i = _handlers.begin(); _i != _handlers.end(); ) \ + const IntModuleList& _handlers = ServerInstance->Modules->EventHandlers[I_ ## y]; \ + for (IntModuleList::const_reverse_iterator _i = _handlers.rbegin(), _next; _i != _handlers.rend(); _i = _next) \ { \ - safei = _i; \ - ++safei; \ + _next = _i+1; \ try \ { \ (*_i)->y x ; \ @@ -136,7 +134,6 @@ struct ModResult { { \ ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "Exception caught: %s",modexcept.GetReason()); \ } \ - _i = safei; \ } \ } while (0); @@ -148,9 +145,10 @@ struct ModResult { */ #define DO_EACH_HOOK(n,v,args) \ do { \ - IntModuleList& _handlers = ServerInstance->Modules->EventHandlers[I_ ## n]; \ - for (EventHandlerIter _i = _handlers.begin(); _i != _handlers.end(); ++_i) \ + const IntModuleList& _handlers = ServerInstance->Modules->EventHandlers[I_ ## n]; \ + for (IntModuleList::const_reverse_iterator _i = _handlers.rbegin(), _next; _i != _handlers.rend(); _i = _next) \ { \ + _next = _i+1; \ try \ { \ v = (*_i)->n args; @@ -278,6 +276,11 @@ enum Implementation */ class CoreExport Module : public classbase, public usecountbase { + /** Detach an event from this module + * @param i Event type to detach + */ + void DetachEvent(Implementation i); + public: /** File that this module was loaded from */ @@ -1270,6 +1273,11 @@ class CoreExport ModuleManager */ void DetachAll(Module* mod); + /** Attach all events to a module (used on module load) + * @param mod Module to attach to all events + */ + void AttachAll(Module* mod); + /** Returns text describing the last module error * @return The last error message to occur */ diff --git a/src/commands/cmd_dns.cpp b/src/commands/cmd_dns.cpp index d10f0f982..2b7114128 100644 --- a/src/commands/cmd_dns.cpp +++ b/src/commands/cmd_dns.cpp @@ -797,9 +797,6 @@ class ModuleDNS : public Module void init() { - Implementation i[] = { I_OnRehash, I_OnUnloadModule }; - ServerInstance->Modules->Attach(i, this, sizeof(i) / sizeof(Implementation)); - ServerInstance->Modules->AddService(this->manager); this->OnRehash(NULL); diff --git a/src/commands/cmd_hostname_lookup.cpp b/src/commands/cmd_hostname_lookup.cpp index 71a32e610..1352f0e78 100644 --- a/src/commands/cmd_hostname_lookup.cpp +++ b/src/commands/cmd_hostname_lookup.cpp @@ -193,12 +193,8 @@ class ModuleHostnameLookup : public Module void init() { - OnRehash(NULL); ServerInstance->Modules->AddService(this->dnsLookup); ServerInstance->Modules->AddService(this->ptrHosts); - - Implementation i[] = { I_OnUserInit, I_OnCheckReady }; - ServerInstance->Modules->Attach(i, this, sizeof(i) / sizeof(Implementation)); } void OnUserInit(LocalUser *user) diff --git a/src/commands/cmd_lusers.cpp b/src/commands/cmd_lusers.cpp index c1f35592a..ef35d1e19 100644 --- a/src/commands/cmd_lusers.cpp +++ b/src/commands/cmd_lusers.cpp @@ -157,8 +157,6 @@ class ModuleLusers : public Module void init() { ServerInstance->Modules->AddService(cmd); - Implementation events[] = { I_OnPostConnect, I_OnUserQuit }; - ServerInstance->Modules->Attach(events, this, sizeof(events)/sizeof(Implementation)); ServerInstance->Modes->AddModeWatcher(&mw); } diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp index a973e44cc..28daf7311 100644 --- a/src/commands/cmd_whowas.cpp +++ b/src/commands/cmd_whowas.cpp @@ -317,8 +317,6 @@ class ModuleWhoWas : public Module void init() { ServerInstance->Modules->AddService(cmd); - Implementation eventlist[] = { I_OnGarbageCollect, I_OnUserQuit, I_OnStats, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); } diff --git a/src/listmode.cpp b/src/listmode.cpp index b7b1cbc51..fb76beab2 100644 --- a/src/listmode.cpp +++ b/src/listmode.cpp @@ -93,8 +93,6 @@ void ListModeBase::DoImplements(Module* m) { ServerInstance->Modules->AddService(extItem); this->DoRehash(); - Implementation eventlist[] = { I_OnSyncChannel, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, m, sizeof(eventlist)/sizeof(Implementation)); } unsigned int ListModeBase::FindLimit(const std::string& channame) diff --git a/src/modmanager_dynamic.cpp b/src/modmanager_dynamic.cpp index a4a3ddb0b..92a7e0a32 100644 --- a/src/modmanager_dynamic.cpp +++ b/src/modmanager_dynamic.cpp @@ -74,6 +74,7 @@ bool ModuleManager::Load(const std::string& filename, bool defer) } else { + AttachAll(newmod); newmod->init(); Version v = newmod->GetVersion(); @@ -233,6 +234,7 @@ void ModuleManager::LoadAll() try { ServerInstance->Logs->Log("MODULE", LOG_DEBUG, "Initializing %s", i->first.c_str()); + AttachAll(mod); mod->init(); } catch (CoreException& modexcept) diff --git a/src/modmanager_static.cpp b/src/modmanager_static.cpp index 40123674b..321bf520d 100644 --- a/src/modmanager_static.cpp +++ b/src/modmanager_static.cpp @@ -102,6 +102,7 @@ bool ModuleManager::Load(const std::string& name, bool defer) } else { + AttachAll(mod); mod->init(); } } @@ -207,6 +208,7 @@ void ModuleManager::LoadAll() Module* mod = i->second; try { + AttachAll(mod); mod->init(); } catch (CoreException& modexcept) diff --git a/src/modules.cpp b/src/modules.cpp index 26e91f876..5fc8ffc47 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -76,86 +76,91 @@ Module::~Module() { } -ModResult Module::OnSendSnotice(char &snomask, std::string &type, const std::string &message) { return MOD_RES_PASSTHRU; } -void Module::OnUserConnect(LocalUser*) { } -void Module::OnUserQuit(User*, const std::string&, const std::string&) { } -void Module::OnUserDisconnect(LocalUser*) { } -void Module::OnUserJoin(Membership*, bool, bool, CUList&) { } -void Module::OnPostJoin(Membership*) { } -void Module::OnUserPart(Membership*, std::string&, CUList&) { } -void Module::OnPreRehash(User*, const std::string&) { } -void Module::OnModuleRehash(User*, const std::string&) { } -void Module::OnRehash(User*) { } -ModResult Module::OnUserPreJoin(LocalUser*, Channel*, const std::string&, std::string&, const std::string&) { return MOD_RES_PASSTHRU; } -void Module::OnMode(User*, User*, Channel*, const std::vector<std::string>&, const std::vector<TranslateType>&) { } -void Module::OnOper(User*, const std::string&) { } -void Module::OnPostOper(User*, const std::string&, const std::string &) { } -void Module::OnInfo(User*) { } -void Module::OnWhois(User*, User*) { } -ModResult Module::OnUserPreInvite(User*, User*, Channel*, time_t) { return MOD_RES_PASSTHRU; } -ModResult Module::OnUserPreMessage(User*, void*, int, std::string&, char, CUList&, MessageType) { return MOD_RES_PASSTHRU; } -ModResult Module::OnUserPreNick(User*, const std::string&) { return MOD_RES_PASSTHRU; } -void Module::OnUserPostNick(User*, const std::string&) { } -ModResult Module::OnPreMode(User*, User*, Channel*, const std::vector<std::string>&) { return MOD_RES_PASSTHRU; } -void Module::On005Numeric(std::map<std::string, std::string>&) { } -ModResult Module::OnKill(User*, User*, const std::string&) { return MOD_RES_PASSTHRU; } -void Module::OnLoadModule(Module*) { } -void Module::OnUnloadModule(Module*) { } -void Module::OnBackgroundTimer(time_t) { } -ModResult Module::OnPreCommand(std::string&, std::vector<std::string>&, LocalUser*, bool, const std::string&) { return MOD_RES_PASSTHRU; } -void Module::OnPostCommand(Command*, const std::vector<std::string>&, LocalUser*, CmdResult, const std::string&) { } -void Module::OnUserInit(LocalUser*) { } -ModResult Module::OnCheckReady(LocalUser*) { return MOD_RES_PASSTHRU; } -ModResult Module::OnUserRegister(LocalUser*) { return MOD_RES_PASSTHRU; } -ModResult Module::OnUserPreKick(User*, Membership*, const std::string&) { return MOD_RES_PASSTHRU; } -void Module::OnUserKick(User*, Membership*, const std::string&, CUList&) { } -ModResult Module::OnRawMode(User*, Channel*, const char, const std::string &, bool, int) { return MOD_RES_PASSTHRU; } -ModResult Module::OnCheckInvite(User*, Channel*) { return MOD_RES_PASSTHRU; } -ModResult Module::OnCheckKey(User*, Channel*, const std::string&) { return MOD_RES_PASSTHRU; } -ModResult Module::OnCheckLimit(User*, Channel*) { return MOD_RES_PASSTHRU; } -ModResult Module::OnCheckChannelBan(User*, Channel*) { return MOD_RES_PASSTHRU; } -ModResult Module::OnCheckBan(User*, Channel*, const std::string&) { return MOD_RES_PASSTHRU; } -ModResult Module::OnExtBanCheck(User*, Channel*, char) { return MOD_RES_PASSTHRU; } -ModResult Module::OnStats(char, User*, string_list&) { return MOD_RES_PASSTHRU; } -ModResult Module::OnChangeLocalUserHost(LocalUser*, const std::string&) { return MOD_RES_PASSTHRU; } -ModResult Module::OnChangeLocalUserGECOS(LocalUser*, const std::string&) { return MOD_RES_PASSTHRU; } -ModResult Module::OnPreTopicChange(User*, Channel*, const std::string&) { return MOD_RES_PASSTHRU; } -void Module::OnEvent(Event&) { } -ModResult Module::OnPassCompare(Extensible* ex, const std::string &password, const std::string &input, const std::string& hashtype) { return MOD_RES_PASSTHRU; } -void Module::OnGlobalOper(User*) { } -void Module::OnPostConnect(User*) { } -void Module::OnUserMessage(User*, void*, int, const std::string&, char, const CUList&, MessageType) { } -void Module::OnUserInvite(User*, User*, Channel*, time_t) { } -void Module::OnPostTopicChange(User*, Channel*, const std::string&) { } -void Module::OnGetServerDescription(const std::string&, std::string&) { } -void Module::OnSyncUser(User*, Module*, void*) { } -void Module::OnSyncChannel(Channel*, Module*, void*) { } -void Module::OnSyncNetwork(Module*, void*) { } +void Module::DetachEvent(Implementation i) +{ + ServerInstance->Modules->Detach(i, this); +} + +ModResult Module::OnSendSnotice(char &snomask, std::string &type, const std::string &message) { DetachEvent(I_OnSendSnotice); return MOD_RES_PASSTHRU; } +void Module::OnUserConnect(LocalUser*) { DetachEvent(I_OnUserConnect); } +void Module::OnUserQuit(User*, const std::string&, const std::string&) { DetachEvent(I_OnUserQuit); } +void Module::OnUserDisconnect(LocalUser*) { DetachEvent(I_OnUserDisconnect); } +void Module::OnUserJoin(Membership*, bool, bool, CUList&) { DetachEvent(I_OnUserJoin); } +void Module::OnPostJoin(Membership*) { DetachEvent(I_OnPostJoin); } +void Module::OnUserPart(Membership*, std::string&, CUList&) { DetachEvent(I_OnUserPart); } +void Module::OnPreRehash(User*, const std::string&) { DetachEvent(I_OnPreRehash); } +void Module::OnModuleRehash(User*, const std::string&) { DetachEvent(I_OnModuleRehash); } +void Module::OnRehash(User*) { DetachEvent(I_OnRehash); } +ModResult Module::OnUserPreJoin(LocalUser*, Channel*, const std::string&, std::string&, const std::string&) { DetachEvent(I_OnUserPreJoin); return MOD_RES_PASSTHRU; } +void Module::OnMode(User*, User*, Channel*, const std::vector<std::string>&, const std::vector<TranslateType>&) { DetachEvent(I_OnMode); } +void Module::OnOper(User*, const std::string&) { DetachEvent(I_OnOper); } +void Module::OnPostOper(User*, const std::string&, const std::string &) { DetachEvent(I_OnPostOper); } +void Module::OnInfo(User*) { DetachEvent(I_OnInfo); } +void Module::OnWhois(User*, User*) { DetachEvent(I_OnWhois); } +ModResult Module::OnUserPreInvite(User*, User*, Channel*, time_t) { DetachEvent(I_OnUserPreInvite); return MOD_RES_PASSTHRU; } +ModResult Module::OnUserPreMessage(User*, void*, int, std::string&, char, CUList&, MessageType) { DetachEvent(I_OnUserPreMessage); return MOD_RES_PASSTHRU; } +ModResult Module::OnUserPreNick(User*, const std::string&) { DetachEvent(I_OnUserPreNick); return MOD_RES_PASSTHRU; } +void Module::OnUserPostNick(User*, const std::string&) { DetachEvent(I_OnUserPostNick); } +ModResult Module::OnPreMode(User*, User*, Channel*, const std::vector<std::string>&) { DetachEvent(I_OnPreMode); return MOD_RES_PASSTHRU; } +void Module::On005Numeric(std::map<std::string, std::string>&) { DetachEvent(I_On005Numeric); } +ModResult Module::OnKill(User*, User*, const std::string&) { DetachEvent(I_OnKill); return MOD_RES_PASSTHRU; } +void Module::OnLoadModule(Module*) { DetachEvent(I_OnLoadModule); } +void Module::OnUnloadModule(Module*) { DetachEvent(I_OnUnloadModule); } +void Module::OnBackgroundTimer(time_t) { DetachEvent(I_OnBackgroundTimer); } +ModResult Module::OnPreCommand(std::string&, std::vector<std::string>&, LocalUser*, bool, const std::string&) { DetachEvent(I_OnPreCommand); return MOD_RES_PASSTHRU; } +void Module::OnPostCommand(Command*, const std::vector<std::string>&, LocalUser*, CmdResult, const std::string&) { DetachEvent(I_OnPostCommand); } +void Module::OnUserInit(LocalUser*) { DetachEvent(I_OnUserInit); } +ModResult Module::OnCheckReady(LocalUser*) { DetachEvent(I_OnCheckReady); return MOD_RES_PASSTHRU; } +ModResult Module::OnUserRegister(LocalUser*) { DetachEvent(I_OnUserRegister); return MOD_RES_PASSTHRU; } +ModResult Module::OnUserPreKick(User*, Membership*, const std::string&) { DetachEvent(I_OnUserPreKick); return MOD_RES_PASSTHRU; } +void Module::OnUserKick(User*, Membership*, const std::string&, CUList&) { DetachEvent(I_OnUserKick); } +ModResult Module::OnRawMode(User*, Channel*, const char, const std::string &, bool, int) { DetachEvent(I_OnRawMode); return MOD_RES_PASSTHRU; } +ModResult Module::OnCheckInvite(User*, Channel*) { DetachEvent(I_OnCheckInvite); return MOD_RES_PASSTHRU; } +ModResult Module::OnCheckKey(User*, Channel*, const std::string&) { DetachEvent(I_OnCheckKey); return MOD_RES_PASSTHRU; } +ModResult Module::OnCheckLimit(User*, Channel*) { DetachEvent(I_OnCheckLimit); return MOD_RES_PASSTHRU; } +ModResult Module::OnCheckChannelBan(User*, Channel*) { DetachEvent(I_OnCheckChannelBan); return MOD_RES_PASSTHRU; } +ModResult Module::OnCheckBan(User*, Channel*, const std::string&) { DetachEvent(I_OnCheckBan); return MOD_RES_PASSTHRU; } +ModResult Module::OnExtBanCheck(User*, Channel*, char) { DetachEvent(I_OnExtBanCheck); return MOD_RES_PASSTHRU; } +ModResult Module::OnStats(char, User*, string_list&) { DetachEvent(I_OnStats); return MOD_RES_PASSTHRU; } +ModResult Module::OnChangeLocalUserHost(LocalUser*, const std::string&) { DetachEvent(I_OnChangeLocalUserHost); return MOD_RES_PASSTHRU; } +ModResult Module::OnChangeLocalUserGECOS(LocalUser*, const std::string&) { DetachEvent(I_OnChangeLocalUserGECOS); return MOD_RES_PASSTHRU; } +ModResult Module::OnPreTopicChange(User*, Channel*, const std::string&) { DetachEvent(I_OnPreTopicChange); return MOD_RES_PASSTHRU; } +void Module::OnEvent(Event&) { DetachEvent(I_OnEvent); } +ModResult Module::OnPassCompare(Extensible* ex, const std::string &password, const std::string &input, const std::string& hashtype) { DetachEvent(I_OnPassCompare); return MOD_RES_PASSTHRU; } +void Module::OnGlobalOper(User*) { DetachEvent(I_OnGlobalOper); } +void Module::OnPostConnect(User*) { DetachEvent(I_OnPostConnect); } +void Module::OnUserMessage(User*, void*, int, const std::string&, char, const CUList&, MessageType) { DetachEvent(I_OnUserMessage); } +void Module::OnUserInvite(User*, User*, Channel*, time_t) { DetachEvent(I_OnUserInvite); } +void Module::OnPostTopicChange(User*, Channel*, const std::string&) { DetachEvent(I_OnPostTopicChange); } +void Module::OnGetServerDescription(const std::string&, std::string&) { DetachEvent(I_OnGetServerDescription); } +void Module::OnSyncUser(User*, Module*, void*) { DetachEvent(I_OnSyncUser); } +void Module::OnSyncChannel(Channel*, Module*, void*) { DetachEvent(I_OnSyncChannel); } +void Module::OnSyncNetwork(Module*, void*) { DetachEvent(I_OnSyncNetwork); } void Module::ProtoSendMode(void*, TargetTypeFlags, void*, const std::vector<std::string>&, const std::vector<TranslateType>&) { } -void Module::OnDecodeMetaData(Extensible*, const std::string&, const std::string&) { } +void Module::OnDecodeMetaData(Extensible*, const std::string&, const std::string&) { DetachEvent(I_OnDecodeMetaData); } void Module::ProtoSendMetaData(void*, Extensible*, const std::string&, const std::string&) { } -void Module::OnChangeHost(User*, const std::string&) { } -void Module::OnChangeName(User*, const std::string&) { } -void Module::OnChangeIdent(User*, const std::string&) { } -void Module::OnAddLine(User*, XLine*) { } -void Module::OnDelLine(User*, XLine*) { } -void Module::OnExpireLine(XLine*) { } +void Module::OnChangeHost(User*, const std::string&) { DetachEvent(I_OnChangeHost); } +void Module::OnChangeName(User*, const std::string&) { DetachEvent(I_OnChangeName); } +void Module::OnChangeIdent(User*, const std::string&) { DetachEvent(I_OnChangeIdent); } +void Module::OnAddLine(User*, XLine*) { DetachEvent(I_OnAddLine); } +void Module::OnDelLine(User*, XLine*) { DetachEvent(I_OnDelLine); } +void Module::OnExpireLine(XLine*) { DetachEvent(I_OnExpireLine); } void Module::OnCleanup(int, void*) { } -ModResult Module::OnChannelPreDelete(Channel*) { return MOD_RES_PASSTHRU; } -void Module::OnChannelDelete(Channel*) { } -ModResult Module::OnSetAway(User*, const std::string &) { 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*, const std::vector<std::string>&, User*, std::string&) { } -void Module::OnSetUserIP(LocalUser*) { } +ModResult Module::OnChannelPreDelete(Channel*) { DetachEvent(I_OnChannelPreDelete); return MOD_RES_PASSTHRU; } +void Module::OnChannelDelete(Channel*) { DetachEvent(I_OnChannelDelete); } +ModResult Module::OnSetAway(User*, const std::string &) { DetachEvent(I_OnSetAway); return MOD_RES_PASSTHRU; } +ModResult Module::OnWhoisLine(User*, User*, int&, std::string&) { DetachEvent(I_OnWhoisLine); return MOD_RES_PASSTHRU; } +void Module::OnBuildNeighborList(User*, UserChanList&, std::map<User*,bool>&) { DetachEvent(I_OnBuildNeighborList); } +void Module::OnGarbageCollect() { DetachEvent(I_OnGarbageCollect); } +ModResult Module::OnSetConnectClass(LocalUser* user, ConnectClass* myclass) { DetachEvent(I_OnSetConnectClass); return MOD_RES_PASSTHRU; } +void Module::OnText(User*, void*, int, const std::string&, char, CUList&) { DetachEvent(I_OnText); } +void Module::OnRunTestSuite() { DetachEvent(I_OnRunTestSuite); } +void Module::OnNamesListItem(User*, Membership*, std::string&, std::string&) { DetachEvent(I_OnNamesListItem); } +ModResult Module::OnNumeric(User*, unsigned int, const std::string&) { DetachEvent(I_OnNumeric); return MOD_RES_PASSTHRU; } +void Module::OnHookIO(StreamSocket*, ListenSocket*) { DetachEvent(I_OnHookIO); } +ModResult Module::OnAcceptConnection(int, ListenSocket*, irc::sockets::sockaddrs*, irc::sockets::sockaddrs*) { DetachEvent(I_OnAcceptConnection); return MOD_RES_PASSTHRU; } +void Module::OnSendWhoLine(User*, const std::vector<std::string>&, User*, std::string&) { DetachEvent(I_OnSendWhoLine); } +void Module::OnSetUserIP(LocalUser*) { DetachEvent(I_OnSetUserIP); } ModuleManager::ModuleManager() : ModCount(0) { @@ -191,6 +196,12 @@ void ModuleManager::Attach(Implementation* i, Module* mod, size_t sz) Attach(i[n], mod); } +void ModuleManager::AttachAll(Module* mod) +{ + for (size_t i = I_BEGIN + 1; i != I_END; ++i) + Attach((Implementation)i, mod); +} + void ModuleManager::DetachAll(Module* mod) { for (size_t n = I_BEGIN + 1; n != I_END; ++n) @@ -233,22 +244,25 @@ bool ModuleManager::SetPriority(Module* mod, Implementation i, Priority s, Modul return false; found_src: + // The modules registered for a hook are called in reverse order (to allow for easier removal + // of list entries while looping), meaning that the Priority given to us has the exact opposite effect + // on the list, e.g.: PRIORITY_BEFORE will actually put 'mod' after 'which', etc. size_t swap_pos = my_pos; switch (s) { - case PRIORITY_FIRST: + case PRIORITY_LAST: if (prioritizationState != PRIO_STATE_FIRST) return true; else swap_pos = 0; break; - case PRIORITY_LAST: + case PRIORITY_FIRST: if (prioritizationState != PRIO_STATE_FIRST) return true; else swap_pos = EventHandlers[i].size() - 1; break; - case PRIORITY_AFTER: + case PRIORITY_BEFORE: { /* Find the latest possible position, only searching AFTER our position */ for (size_t x = EventHandlers[i].size() - 1; x > my_pos; --x) @@ -263,7 +277,7 @@ found_src: return true; } /* Place this module before a set of other modules */ - case PRIORITY_BEFORE: + case PRIORITY_AFTER: { for (size_t x = 0; x < my_pos; ++x) { diff --git a/src/modules/extra/m_geoip.cpp b/src/modules/extra/m_geoip.cpp index fffadcd32..50df9fc26 100644 --- a/src/modules/extra/m_geoip.cpp +++ b/src/modules/extra/m_geoip.cpp @@ -57,8 +57,6 @@ class ModuleGeoIP : public Module throw ModuleException("Unable to initialize geoip, are you missing GeoIP.dat?"); ServerInstance->Modules->AddService(ext); - Implementation eventlist[] = { I_OnSetConnectClass, I_OnStats }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); for (LocalUserList::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); ++i) { diff --git a/src/modules/extra/m_ldapauth.cpp b/src/modules/extra/m_ldapauth.cpp index 250fce8c1..517a6d395 100644 --- a/src/modules/extra/m_ldapauth.cpp +++ b/src/modules/extra/m_ldapauth.cpp @@ -122,8 +122,6 @@ public: { ServerInstance->Modules->AddService(ldapAuthed); ServerInstance->Modules->AddService(ldapVhost); - Implementation eventlist[] = { I_OnCheckReady, I_OnRehash,I_OnUserRegister, I_OnUserConnect }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); } diff --git a/src/modules/extra/m_ldapoper.cpp b/src/modules/extra/m_ldapoper.cpp index 68e4cbf9f..af7b48d07 100644 --- a/src/modules/extra/m_ldapoper.cpp +++ b/src/modules/extra/m_ldapoper.cpp @@ -99,8 +99,6 @@ public: void init() CXX11_OVERRIDE { - Implementation eventlist[] = { I_OnRehash, I_OnPreCommand }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); } diff --git a/src/modules/extra/m_mssql.cpp b/src/modules/extra/m_mssql.cpp index 5e50f1325..38bf60e40 100644 --- a/src/modules/extra/m_mssql.cpp +++ b/src/modules/extra/m_mssql.cpp @@ -658,8 +658,6 @@ class ModuleMsSQL : public Module ServerInstance->Threads->Start(queryDispatcher); - Implementation eventlist[] = { I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); ServerInstance->Modules->AddService(sqlserv); } diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 529682bb8..2d20a82ab 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -382,9 +382,6 @@ void ModuleSQL::init() Dispatcher = new DispatcherThread(this); ServerInstance->Threads->Start(Dispatcher); - Implementation eventlist[] = { I_OnRehash, I_OnUnloadModule }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - OnRehash(NULL); } diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index f8889ed63..2300c9d5b 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -511,9 +511,6 @@ class ModulePgSQL : public Module void init() CXX11_OVERRIDE { ReadConf(); - - Implementation eventlist[] = { I_OnUnloadModule, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } ~ModulePgSQL() diff --git a/src/modules/extra/m_regex_posix.cpp b/src/modules/extra/m_regex_posix.cpp index 064edb5f6..3a35ce43b 100644 --- a/src/modules/extra/m_regex_posix.cpp +++ b/src/modules/extra/m_regex_posix.cpp @@ -95,8 +95,6 @@ class ModuleRegexPOSIX : public Module ModuleRegexPOSIX() : ref(this) { ServerInstance->Modules->AddService(ref); - Implementation eventlist[] = { I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); } diff --git a/src/modules/extra/m_regex_stdlib.cpp b/src/modules/extra/m_regex_stdlib.cpp index 5d2294c87..8a4a8cd23 100644 --- a/src/modules/extra/m_regex_stdlib.cpp +++ b/src/modules/extra/m_regex_stdlib.cpp @@ -72,8 +72,6 @@ public: ModuleRegexStd() : ref(this) { ServerInstance->Modules->AddService(ref); - Implementation eventlist[] = { I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); } diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index 945584df2..71ba6e613 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -206,9 +206,6 @@ class ModuleSQLite3 : public Module void init() CXX11_OVERRIDE { ReadConf(); - - Implementation eventlist[] = { I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } ~ModuleSQLite3() diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 68e12e208..a3502a57b 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -626,9 +626,6 @@ class ModuleSSLGnuTLS : public Module // Void return, guess we assume success gnutls_certificate_set_dh_params(iohook.x509_cred, dh_params); - Implementation eventlist[] = { I_On005Numeric, I_OnRehash, I_OnModuleRehash, I_OnUserConnect, - I_OnEvent, I_OnHookIO }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); ServerInstance->Modules->AddService(iohook); ServerInstance->Modules->AddService(starttls); diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index a0043b7aa..29f574fd0 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -494,8 +494,6 @@ class ModuleSSLOpenSSL : public Module { // Needs the flag as it ignores a plain /rehash OnModuleRehash(NULL,"ssl"); - Implementation eventlist[] = { I_On005Numeric, I_OnRehash, I_OnModuleRehash, I_OnHookIO, I_OnUserConnect }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); ServerInstance->Modules->AddService(iohook); } diff --git a/src/modules/m_abbreviation.cpp b/src/modules/m_abbreviation.cpp index 7d094d7a2..32878614d 100644 --- a/src/modules/m_abbreviation.cpp +++ b/src/modules/m_abbreviation.cpp @@ -22,11 +22,6 @@ class ModuleAbbreviation : public Module { public: - void init() CXX11_OVERRIDE - { - ServerInstance->Modules->Attach(I_OnPreCommand, this); - } - void Prioritize() { ServerInstance->Modules->SetPriority(this, I_OnPreCommand, PRIORITY_FIRST); diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 73e3bfd46..4d942854c 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -105,8 +105,6 @@ class ModuleAlias : public Module void init() CXX11_OVERRIDE { ReadAliases(); - Implementation eventlist[] = { I_OnPreCommand, I_OnRehash, I_OnUserMessage }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_allowinvite.cpp b/src/modules/m_allowinvite.cpp index 1130dd223..a33bee832 100644 --- a/src/modules/m_allowinvite.cpp +++ b/src/modules/m_allowinvite.cpp @@ -37,8 +37,6 @@ class ModuleAllowInvite : public Module void init() CXX11_OVERRIDE { ServerInstance->Modules->AddService(ni); - Implementation eventlist[] = { I_OnUserPreInvite, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp index ae2134cc1..af828c130 100644 --- a/src/modules/m_auditorium.cpp +++ b/src/modules/m_auditorium.cpp @@ -56,12 +56,6 @@ class ModuleAuditorium : public Module ServerInstance->Modules->AddService(aum); OnRehash(NULL); - - Implementation eventlist[] = { - I_OnUserJoin, I_OnUserPart, I_OnUserKick, - I_OnBuildNeighborList, I_OnNamesListItem, I_OnSendWhoLine, - I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void OnRehash(User* user) CXX11_OVERRIDE diff --git a/src/modules/m_autoop.cpp b/src/modules/m_autoop.cpp index df90f70c9..6bc5f464c 100644 --- a/src/modules/m_autoop.cpp +++ b/src/modules/m_autoop.cpp @@ -89,9 +89,6 @@ class ModuleAutoOp : public Module { ServerInstance->Modules->AddService(mh); mh.DoImplements(this); - - Implementation list[] = { I_OnPostJoin, }; - ServerInstance->Modules->Attach(list, this, sizeof(list)/sizeof(Implementation)); } void OnPostJoin(Membership *memb) CXX11_OVERRIDE diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp index 2eb5083f9..e142af0de 100644 --- a/src/modules/m_banexception.cpp +++ b/src/modules/m_banexception.cpp @@ -56,8 +56,6 @@ class ModuleBanException : public Module ServerInstance->Modules->AddService(be); be.DoImplements(this); - Implementation list[] = { I_OnRehash, I_On005Numeric, I_OnExtBanCheck, I_OnCheckChannelBan }; - ServerInstance->Modules->Attach(list, this, sizeof(list)/sizeof(Implementation)); } void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 446d575df..73d8270d1 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -233,8 +233,6 @@ class ModuleBanRedirect : public Module { ServerInstance->Modes->AddModeWatcher(&re); ServerInstance->Modules->AddService(re.extItem); - Implementation list[] = { I_OnUserPreJoin }; - ServerInstance->Modules->Attach(list, this, sizeof(list)/sizeof(Implementation)); } void OnCleanup(int target_type, void* item) CXX11_OVERRIDE diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index 3521bd89d..b71247d71 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -61,8 +61,6 @@ class ModuleBlockAmsg : public Module { this->OnRehash(NULL); ServerInstance->Modules->AddService(blockamsg); - Implementation eventlist[] = { I_OnRehash, I_OnPreCommand }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index 0eab38588..8e7d76f4a 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -47,8 +47,6 @@ public: { OnRehash(NULL); ServerInstance->Modules->AddService(bc); - Implementation eventlist[] = { I_OnUserPreMessage, I_OnRehash, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index e2fa2e3d6..6e04e53da 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -43,8 +43,6 @@ class ModuleBlockColor : public Module void init() CXX11_OVERRIDE { ServerInstance->Modules->AddService(bc); - Implementation eventlist[] = { I_OnUserPreMessage, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index 4a4ea68d0..7c2794789 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -41,8 +41,6 @@ class ModuleBotMode : public Module void init() CXX11_OVERRIDE { ServerInstance->Modules->AddService(bm); - Implementation eventlist[] = { I_OnWhois }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index 5a18730af..3d2394fb1 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -368,9 +368,6 @@ public: ServerInstance->Modules->AddService(myumode); ServerInstance->Modules->AddService(cmd); ServerInstance->Modules->AddService(cmd.extInfo); - - Implementation eventlist[] = { I_OnRehash, I_OnUserPostNick, I_OnUserQuit, I_On005Numeric, I_OnUserPreMessage }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index fa7a3d30c..35c24fd23 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -129,9 +129,6 @@ class ModuleCAP : public Module { ServerInstance->Modules->AddService(cmd); ServerInstance->Modules->AddService(cmd.reghold); - - Implementation eventlist[] = { I_OnCheckReady }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } ModResult OnCheckReady(LocalUser* user) CXX11_OVERRIDE diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index d66a15f37..39a5d6266 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -159,8 +159,6 @@ class ModuleCBan : public Module ServerInstance->XLines->RegisterFactory(&f); ServerInstance->Modules->AddService(mycommand); - Implementation eventlist[] = { I_OnUserPreJoin, I_OnStats }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } ~ModuleCBan() diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index 148c460de..747c16d83 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -60,8 +60,6 @@ class ModuleCensor : public Module OnRehash(NULL); ServerInstance->Modules->AddService(cu); ServerInstance->Modules->AddService(cc); - Implementation eventlist[] = { I_OnRehash, I_OnUserPreMessage }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } // format of a config entry is <badword text="shit" replace="poo"> diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index cac143f39..65671632d 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -239,9 +239,6 @@ public: OnRehash(NULL); ServiceProvider* providerlist[] = { &cmd, &cmd.realhost, &cmd.realip, &cmd.webirc_hostname, &cmd.webirc_ip, &waiting }; ServerInstance->Modules->AddServices(providerlist, sizeof(providerlist)/sizeof(ServiceProvider*)); - - Implementation eventlist[] = { I_OnRehash, I_OnUserRegister, I_OnCheckReady }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void OnRehash(User* user) CXX11_OVERRIDE diff --git a/src/modules/m_chancreate.cpp b/src/modules/m_chancreate.cpp index 35b1a98db..6cf4af235 100644 --- a/src/modules/m_chancreate.cpp +++ b/src/modules/m_chancreate.cpp @@ -27,8 +27,6 @@ class ModuleChanCreate : public Module void init() CXX11_OVERRIDE { ServerInstance->SNO->EnableSnomask('j', "CHANCREATE"); - Implementation eventlist[] = { I_OnUserJoin }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index fdc45a97e..38ee14e60 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -80,8 +80,6 @@ class ModuleChanFilter : public Module ServerInstance->Modules->AddService(cf); cf.DoImplements(this); - Implementation eventlist[] = { I_OnRehash, I_OnUserPreMessage, I_OnSyncChannel }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); } diff --git a/src/modules/m_chanhistory.cpp b/src/modules/m_chanhistory.cpp index 464195e39..bace497c2 100644 --- a/src/modules/m_chanhistory.cpp +++ b/src/modules/m_chanhistory.cpp @@ -117,8 +117,6 @@ class ModuleChanHistory : public Module ServerInstance->Modules->AddService(m); ServerInstance->Modules->AddService(m.ext); - Implementation eventlist[] = { I_OnPostJoin, I_OnUserMessage, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); } diff --git a/src/modules/m_chanlog.cpp b/src/modules/m_chanlog.cpp index fb7f5f1c0..a62fbf9b2 100644 --- a/src/modules/m_chanlog.cpp +++ b/src/modules/m_chanlog.cpp @@ -31,9 +31,6 @@ class ModuleChanLog : public Module public: void init() CXX11_OVERRIDE { - Implementation eventlist[] = { I_OnRehash, I_OnSendSnotice }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - OnRehash(NULL); } diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp index aed3ec226..4228d5050 100644 --- a/src/modules/m_channames.cpp +++ b/src/modules/m_channames.cpp @@ -62,8 +62,6 @@ class ModuleChannelNames : public Module void init() CXX11_OVERRIDE { ServerInstance->IsChannel = &myhandler; - Implementation eventlist[] = { I_OnRehash, I_OnUserKick }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); } diff --git a/src/modules/m_channelban.cpp b/src/modules/m_channelban.cpp index 50df8a782..3260c0fa4 100644 --- a/src/modules/m_channelban.cpp +++ b/src/modules/m_channelban.cpp @@ -23,12 +23,6 @@ class ModuleBadChannelExtban : public Module { public: - void init() CXX11_OVERRIDE - { - Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - } - Version GetVersion() CXX11_OVERRIDE { return Version("Extban 'j' - channel status/join ban", VF_OPTCOMMON|VF_VENDOR); diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index e0944b46b..4fcb5ce80 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -98,8 +98,6 @@ class ModuleChgHost : public Module { OnRehash(NULL); ServerInstance->Modules->AddService(cmd); - Implementation eventlist[] = { I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void OnRehash(User* user) CXX11_OVERRIDE diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index b258a1fe1..4e203d14c 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -153,9 +153,6 @@ class ModuleCloaking : public Module ServerInstance->Modules->AddService(cu); ServerInstance->Modules->AddService(ck); ServerInstance->Modules->AddService(cu.ext); - - Implementation eventlist[] = { I_OnRehash, I_OnCheckBan, I_OnUserConnect, I_OnChangeHost }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } /** This function takes a domain name string and returns just the last two domain parts, diff --git a/src/modules/m_commonchans.cpp b/src/modules/m_commonchans.cpp index 02125c2ae..5871f5f9d 100644 --- a/src/modules/m_commonchans.cpp +++ b/src/modules/m_commonchans.cpp @@ -38,7 +38,6 @@ class ModulePrivacyMode : public Module void init() CXX11_OVERRIDE { ServerInstance->Modules->AddService(pm); - ServerInstance->Modules->Attach(I_OnUserPreMessage, this); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp index 182b77b99..fdcf82dcc 100644 --- a/src/modules/m_conn_join.cpp +++ b/src/modules/m_conn_join.cpp @@ -25,12 +25,6 @@ class ModuleConnJoin : public Module { public: - void init() CXX11_OVERRIDE - { - Implementation eventlist[] = { I_OnPostConnect }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - } - void Prioritize() { ServerInstance->Modules->SetPriority(this, I_OnPostConnect, PRIORITY_LAST); diff --git a/src/modules/m_conn_umodes.cpp b/src/modules/m_conn_umodes.cpp index 47f0fc1bc..bae9317d5 100644 --- a/src/modules/m_conn_umodes.cpp +++ b/src/modules/m_conn_umodes.cpp @@ -25,11 +25,6 @@ class ModuleModesOnConnect : public Module { public: - void init() CXX11_OVERRIDE - { - ServerInstance->Modules->Attach(I_OnUserConnect, this); - } - void Prioritize() { // for things like +x on connect, important, otherwise we have to resort to config order (bleh) -- w00t diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp index 677510e8f..c15205df3 100644 --- a/src/modules/m_conn_waitpong.cpp +++ b/src/modules/m_conn_waitpong.cpp @@ -40,8 +40,6 @@ class ModuleWaitPong : public Module { ServerInstance->Modules->AddService(ext); OnRehash(NULL); - Implementation eventlist[] = { I_OnUserRegister, I_OnCheckReady, I_OnPreCommand, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void OnRehash(User* user) CXX11_OVERRIDE diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp index ca32aa64f..c730602a1 100644 --- a/src/modules/m_connectban.cpp +++ b/src/modules/m_connectban.cpp @@ -31,8 +31,6 @@ class ModuleConnectBan : public Module public: void init() CXX11_OVERRIDE { - Implementation eventlist[] = { I_OnSetUserIP, I_OnGarbageCollect, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); } diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp index 589e1226d..23b570bf6 100644 --- a/src/modules/m_connflood.cpp +++ b/src/modules/m_connflood.cpp @@ -39,8 +39,6 @@ public: void init() CXX11_OVERRIDE { InitConf(); - Implementation eventlist[] = { I_OnRehash, I_OnUserRegister }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index 86ed66110..5a3a925a3 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -83,7 +83,6 @@ class ModuleCustomTitle : public Module { ServerInstance->Modules->AddService(cmd); ServerInstance->Modules->AddService(cmd.ctitle); - ServerInstance->Modules->Attach(I_OnWhoisLine, this); } // :kenny.chatspike.net 320 Brain Azhrarn :is getting paid to play games. diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 95a03ef0d..d65537537 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -259,8 +259,6 @@ class ModuleDCCAllow : public Module ServerInstance->Modules->AddService(*ext); ServerInstance->Modules->AddService(cmd); ReadFileConf(); - Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserQuit, I_OnUserPostNick, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void OnRehash(User* user) CXX11_OVERRIDE diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp index dfc37b72b..2e07aea41 100644 --- a/src/modules/m_deaf.cpp +++ b/src/modules/m_deaf.cpp @@ -58,8 +58,6 @@ class ModuleDeaf : public Module ServerInstance->Modules->AddService(m1); OnRehash(NULL); - Implementation eventlist[] = { I_OnUserPreMessage, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void OnRehash(User* user) CXX11_OVERRIDE diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index 525388a42..444cbbc39 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -48,8 +48,6 @@ class ModuleDelayJoin : public Module { ServerInstance->Modules->AddService(djm); ServerInstance->Modules->AddService(unjoined); - Implementation eventlist[] = { I_OnUserJoin, I_OnUserPart, I_OnUserKick, I_OnBuildNeighborList, I_OnNamesListItem, I_OnText, I_OnRawMode }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } Version GetVersion() CXX11_OVERRIDE; void OnNamesListItem(User* issuer, Membership*, std::string &prefixes, std::string &nick) CXX11_OVERRIDE; diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp index cc22a3926..1e16647f3 100644 --- a/src/modules/m_delaymsg.cpp +++ b/src/modules/m_delaymsg.cpp @@ -49,8 +49,6 @@ class ModuleDelayMsg : public Module { ServerInstance->Modules->AddService(djm); ServerInstance->Modules->AddService(djm.jointime); - Implementation eventlist[] = { I_OnUserJoin, I_OnUserPreMessage}; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } Version GetVersion() CXX11_OVERRIDE; void OnUserJoin(Membership* memb, bool sync, bool created, CUList&) CXX11_OVERRIDE; diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp index 60af0e391..237447ac7 100644 --- a/src/modules/m_denychans.cpp +++ b/src/modules/m_denychans.cpp @@ -32,12 +32,6 @@ class ModuleDenyChannels : public Module { } - void init() CXX11_OVERRIDE - { - Implementation eventlist[] = { I_OnUserPreJoin, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - } - void OnRehash(User* user) CXX11_OVERRIDE { /* check for redirect validity and loops/chains */ diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index e05dab367..d6433f142 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -234,8 +234,6 @@ class ModuleDNSBL : public Module ReadConf(); ServerInstance->Modules->AddService(nameExt); ServerInstance->Modules->AddService(countExt); - Implementation eventlist[] = { I_OnRehash, I_OnSetUserIP, I_OnStats, I_OnSetConnectClass, I_OnCheckReady }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } ~ModuleDNSBL() diff --git a/src/modules/m_exemptchanops.cpp b/src/modules/m_exemptchanops.cpp index e3f819117..a74658bcd 100644 --- a/src/modules/m_exemptchanops.cpp +++ b/src/modules/m_exemptchanops.cpp @@ -116,8 +116,6 @@ class ModuleExemptChanOps : public Module void init() CXX11_OVERRIDE { ServerInstance->Modules->AddService(eh.ec); - Implementation eventlist[] = { I_OnRehash, I_OnSyncChannel }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); ServerInstance->OnCheckExemption = &eh; OnRehash(NULL); diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index e4d4a71aa..30ee35f88 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -301,8 +301,6 @@ ModuleFilter::ModuleFilter() void ModuleFilter::init() { ServerInstance->Modules->AddService(filtcommand); - Implementation eventlist[] = { I_OnPreCommand, I_OnStats, I_OnSyncNetwork, I_OnDecodeMetaData, I_OnUserPreMessage, I_OnRehash, I_OnUnloadModule }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); } diff --git a/src/modules/m_gecosban.cpp b/src/modules/m_gecosban.cpp index 49dd117a1..a15f19418 100644 --- a/src/modules/m_gecosban.cpp +++ b/src/modules/m_gecosban.cpp @@ -22,12 +22,6 @@ class ModuleGecosBan : public Module { public: - void init() CXX11_OVERRIDE - { - Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - } - Version GetVersion() CXX11_OVERRIDE { return Version("Extban 'r' - realname (gecos) ban", VF_OPTCOMMON|VF_VENDOR); diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index a2fead630..7d7e9663a 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -111,8 +111,6 @@ class ModuleHelpop : public Module ReadConfig(); ServerInstance->Modules->AddService(ho); ServerInstance->Modules->AddService(cmd); - Implementation eventlist[] = { I_OnRehash, I_OnWhois }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void ReadConfig() diff --git a/src/modules/m_hidechans.cpp b/src/modules/m_hidechans.cpp index bfc0c519a..1bf87bd14 100644 --- a/src/modules/m_hidechans.cpp +++ b/src/modules/m_hidechans.cpp @@ -40,8 +40,6 @@ class ModuleHideChans : public Module void init() CXX11_OVERRIDE { ServerInstance->Modules->AddService(hm); - Implementation eventlist[] = { I_OnWhoisLine, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); } diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp index 3ea653a75..ded6f6791 100644 --- a/src/modules/m_hideoper.cpp +++ b/src/modules/m_hideoper.cpp @@ -44,8 +44,6 @@ class ModuleHideOper : public Module void init() CXX11_OVERRIDE { ServerInstance->Modules->AddService(hm); - Implementation eventlist[] = { I_OnWhoisLine, I_OnSendWhoLine }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index ac53e793c..74c58b22a 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -54,8 +54,6 @@ class ModuleHostChange : public Module void init() CXX11_OVERRIDE { OnRehash(NULL); - Implementation eventlist[] = { I_OnRehash, I_OnUserConnect }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void OnRehash(User* user) CXX11_OVERRIDE diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index bb5d5c0b0..e6ed69380 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -360,7 +360,6 @@ class ModuleHttpServer : public Module { HttpModule = this; ServerInstance->Modules->AddService(APIImpl); - ServerInstance->Modules->Attach(I_OnAcceptConnection, this); } ModResult OnAcceptConnection(int nfd, ListenSocket* from, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) CXX11_OVERRIDE diff --git a/src/modules/m_httpd_acl.cpp b/src/modules/m_httpd_acl.cpp index 4163daf2a..272316440 100644 --- a/src/modules/m_httpd_acl.cpp +++ b/src/modules/m_httpd_acl.cpp @@ -96,8 +96,6 @@ class ModuleHTTPAccessList : public Module void init() CXX11_OVERRIDE { OnRehash(NULL); - Implementation eventlist[] = { I_OnEvent, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void BlockAccess(HTTPRequest* http, int returnval, const std::string &extraheaderkey = "", const std::string &extraheaderval="") diff --git a/src/modules/m_httpd_config.cpp b/src/modules/m_httpd_config.cpp index d495cfb59..8333d9f9c 100644 --- a/src/modules/m_httpd_config.cpp +++ b/src/modules/m_httpd_config.cpp @@ -32,12 +32,6 @@ class ModuleHttpConfig : public Module { } - void init() CXX11_OVERRIDE - { - Implementation eventlist[] = { I_OnEvent }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - } - std::string Sanitize(const std::string &str) { std::string ret; diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 3f8fa1b4a..df98ef3f5 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -37,12 +37,6 @@ class ModuleHttpStats : public Module { } - void init() CXX11_OVERRIDE - { - Implementation eventlist[] = { I_OnEvent }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - } - std::string Sanitize(const std::string &str) { std::string ret; diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index a2754055f..12a71144f 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -280,11 +280,6 @@ class ModuleIdent : public Module { ServerInstance->Modules->AddService(ext); OnRehash(NULL); - Implementation eventlist[] = { - I_OnRehash, I_OnUserInit, I_OnCheckReady, - I_OnUserDisconnect, I_OnSetConnectClass - }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp index 9eaa5be73..700df27fb 100644 --- a/src/modules/m_inviteexception.cpp +++ b/src/modules/m_inviteexception.cpp @@ -57,8 +57,6 @@ public: OnRehash(NULL); ie.DoImplements(this); - Implementation eventlist[] = { I_On005Numeric, I_OnCheckInvite, I_OnCheckKey, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE diff --git a/src/modules/m_ircv3.cpp b/src/modules/m_ircv3.cpp index 643e6a7b3..59a69f669 100644 --- a/src/modules/m_ircv3.cpp +++ b/src/modules/m_ircv3.cpp @@ -79,8 +79,6 @@ class ModuleIRCv3 : public Module void init() CXX11_OVERRIDE { OnRehash(NULL); - Implementation eventlist[] = { I_OnUserJoin, I_OnPostJoin, I_OnSetAway, I_OnEvent, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void OnRehash(User* user) CXX11_OVERRIDE diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index 39ba3f9a0..efb277f81 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -149,8 +149,6 @@ class ModuleJoinFlood : public Module { ServerInstance->Modules->AddService(jf); ServerInstance->Modules->AddService(jf.ext); - Implementation eventlist[] = { I_OnUserPreJoin, I_OnUserJoin }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp index 50aa26c91..e6c8e4e13 100644 --- a/src/modules/m_jumpserver.cpp +++ b/src/modules/m_jumpserver.cpp @@ -139,8 +139,6 @@ class ModuleJumpServer : public Module void init() CXX11_OVERRIDE { ServerInstance->Modules->AddService(js); - Implementation eventlist[] = { I_OnUserRegister, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } ModResult OnUserRegister(LocalUser* user) CXX11_OVERRIDE diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index cefba1b1a..bb04610de 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -80,8 +80,6 @@ public: { ServerInstance->Modules->AddService(kr); ServerInstance->Modules->AddService(kr.ext); - Implementation eventlist[] = { I_OnUserPreJoin, I_OnUserKick }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index 3aa49094e..96ea66d7b 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -100,7 +100,6 @@ class ModuleKnock : public Module ServerInstance->Modules->AddService(kn); ServerInstance->Modules->AddService(cmd); - ServerInstance->Modules->Attach(I_OnRehash, this); OnRehash(NULL); } diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp index 74b4b214c..8fae86e1e 100644 --- a/src/modules/m_lockserv.cpp +++ b/src/modules/m_lockserv.cpp @@ -91,8 +91,6 @@ class ModuleLockserv : public Module locked = false; ServerInstance->Modules->AddService(lockcommand); ServerInstance->Modules->AddService(unlockcommand); - Implementation eventlist[] = { I_OnUserRegister, I_OnRehash, I_OnCheckReady }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void OnRehash(User* user) CXX11_OVERRIDE diff --git a/src/modules/m_maphide.cpp b/src/modules/m_maphide.cpp index ee6f7528d..21072c1fc 100644 --- a/src/modules/m_maphide.cpp +++ b/src/modules/m_maphide.cpp @@ -25,8 +25,6 @@ class ModuleMapHide : public Module public: void init() CXX11_OVERRIDE { - Implementation eventlist[] = { I_OnPreCommand, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); } diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index 776841bcc..ef7bf9d52 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -128,7 +128,6 @@ class ModuleMsgFlood : public Module { ServerInstance->Modules->AddService(mf); ServerInstance->Modules->AddService(mf.ext); - ServerInstance->Modules->Attach(I_OnUserPreMessage, this); } ModResult ProcessMessages(User* user,Channel* dest, const std::string &text) diff --git a/src/modules/m_mlock.cpp b/src/modules/m_mlock.cpp index 8ad062aea..abcd79667 100644 --- a/src/modules/m_mlock.cpp +++ b/src/modules/m_mlock.cpp @@ -28,7 +28,6 @@ public: void init() CXX11_OVERRIDE { - ServerInstance->Modules->Attach(I_OnPreMode, this); ServerInstance->Modules->AddService(this->mlock); } diff --git a/src/modules/m_muteban.cpp b/src/modules/m_muteban.cpp index 00c44a639..06ede1f54 100644 --- a/src/modules/m_muteban.cpp +++ b/src/modules/m_muteban.cpp @@ -23,12 +23,6 @@ class ModuleQuietBan : public Module { public: - void init() CXX11_OVERRIDE - { - Implementation eventlist[] = { I_OnUserPreMessage, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - } - Version GetVersion() CXX11_OVERRIDE { return Version("Implements extban +b m: - mute bans",VF_OPTCOMMON|VF_VENDOR); diff --git a/src/modules/m_namedmodes.cpp b/src/modules/m_namedmodes.cpp index d53b71b67..8647cebb4 100644 --- a/src/modules/m_namedmodes.cpp +++ b/src/modules/m_namedmodes.cpp @@ -107,9 +107,6 @@ class ModuleNamedModes : public Module { ServerInstance->Modules->AddService(cmd); ServerInstance->Modules->AddService(dummyZ); - - Implementation eventlist[] = { I_OnPreMode }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp index 60289c29c..afbf7a8e2 100644 --- a/src/modules/m_namesx.cpp +++ b/src/modules/m_namesx.cpp @@ -31,12 +31,6 @@ class ModuleNamesX : public Module { } - void init() CXX11_OVERRIDE - { - Implementation eventlist[] = { I_OnPreCommand, I_OnNamesListItem, I_On005Numeric, I_OnEvent, I_OnSendWhoLine }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - } - Version GetVersion() CXX11_OVERRIDE { return Version("Provides the NAMESX (CAP multi-prefix) capability.",VF_VENDOR); diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp index 927a5a4da..10347ac67 100644 --- a/src/modules/m_nationalchars.cpp +++ b/src/modules/m_nationalchars.cpp @@ -240,8 +240,6 @@ class ModuleNationalChars : public Module ServerInstance->IsNick = &myhandler; - Implementation eventlist[] = { I_OnRehash, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); } diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index 742f71d02..66e7ca520 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -140,8 +140,6 @@ class ModuleNickFlood : public Module { ServerInstance->Modules->AddService(nf); ServerInstance->Modules->AddService(nf.ext); - Implementation eventlist[] = { I_OnUserPreNick, I_OnUserPostNick }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } ModResult OnUserPreNick(User* user, const std::string &newnick) CXX11_OVERRIDE diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index 0d820625d..6c4101bc5 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -153,7 +153,6 @@ class ModuleNickLock : public Module ServerInstance->Modules->AddService(cmd1); ServerInstance->Modules->AddService(cmd2); ServerInstance->Modules->AddService(locked); - ServerInstance->Modules->Attach(I_OnUserPreNick, this); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index 94afe8bbb..d791dca36 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -40,8 +40,6 @@ class ModuleNoCTCP : public Module void init() CXX11_OVERRIDE { ServerInstance->Modules->AddService(nc); - Implementation eventlist[] = { I_OnUserPreMessage, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index 8cea94196..5e58f002c 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -41,8 +41,6 @@ class ModuleNoKicks : public Module void init() CXX11_OVERRIDE { ServerInstance->Modules->AddService(nk); - Implementation eventlist[] = { I_OnUserPreKick, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index 1d5e7d785..4078e54a4 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -40,8 +40,6 @@ class ModuleNoNickChange : public Module { OnRehash(NULL); ServerInstance->Modules->AddService(nn); - Implementation eventlist[] = { I_OnUserPreNick, I_On005Numeric, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index 1fdbdde2a..cf8da5f55 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -40,8 +40,6 @@ class ModuleNoNotice : public Module void init() CXX11_OVERRIDE { ServerInstance->Modules->AddService(nt); - Implementation eventlist[] = { I_OnUserPreMessage, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE diff --git a/src/modules/m_nopartmsg.cpp b/src/modules/m_nopartmsg.cpp index 6d0f0a1c7..7aeb66920 100644 --- a/src/modules/m_nopartmsg.cpp +++ b/src/modules/m_nopartmsg.cpp @@ -22,12 +22,6 @@ class ModulePartMsgBan : public Module { public: - void init() CXX11_OVERRIDE - { - Implementation eventlist[] = { I_OnUserPart, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - } - Version GetVersion() CXX11_OVERRIDE { return Version("Implements extban +b p: - part message bans", VF_OPTCOMMON|VF_VENDOR); diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp index 042b2aaba..8f7fe4460 100644 --- a/src/modules/m_ojoin.cpp +++ b/src/modules/m_ojoin.cpp @@ -142,9 +142,6 @@ class ModuleOjoin : public Module ServerInstance->Modules->AddService(*np); ServerInstance->Modules->AddService(mycommand); - - Implementation eventlist[] = { I_OnUserPreJoin, I_OnUserPreKick, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp index 62c8b0d5d..73ef130b9 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -43,8 +43,6 @@ class ModuleOperChans : public Module void init() CXX11_OVERRIDE { ServerInstance->Modules->AddService(oc); - Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric, I_OnUserPreJoin }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp index e421958b3..80bb73ad4 100644 --- a/src/modules/m_operjoin.cpp +++ b/src/modules/m_operjoin.cpp @@ -53,8 +53,6 @@ class ModuleOperjoin : public Module void init() CXX11_OVERRIDE { OnRehash(NULL); - Implementation eventlist[] = { I_OnPostOper, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index 54cd07008..cacedd62d 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -25,11 +25,6 @@ class ModuleOperLevels : public Module { public: - void init() CXX11_OVERRIDE - { - ServerInstance->Modules->Attach(I_OnKill, this); - } - Version GetVersion() CXX11_OVERRIDE { return Version("Gives each oper type a 'level', cannot kill opers 'above' your level.", VF_VENDOR); diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp index cf816897b..42a0e4ecf 100644 --- a/src/modules/m_operlog.cpp +++ b/src/modules/m_operlog.cpp @@ -28,8 +28,6 @@ class ModuleOperLog : public Module public: void init() CXX11_OVERRIDE { - Implementation eventlist[] = { I_OnPreCommand, I_On005Numeric, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); ServerInstance->SNO->EnableSnomask('r', "OPERLOG"); OnRehash(NULL); } diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp index ee726222d..7ab54cedf 100644 --- a/src/modules/m_opermodes.cpp +++ b/src/modules/m_opermodes.cpp @@ -25,11 +25,6 @@ class ModuleModesOnOper : public Module { public: - void init() CXX11_OVERRIDE - { - ServerInstance->Modules->Attach(I_OnPostOper, this); - } - Version GetVersion() CXX11_OVERRIDE { return Version("Sets (and unsets) modes on opers when they oper up", VF_VENDOR); diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index 6abf16b78..1be81e641 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -84,8 +84,6 @@ class ModuleOpermotd : public Module { ServerInstance->Modules->AddService(cmd); OnRehash(NULL); - Implementation eventlist[] = { I_OnRehash, I_OnOper }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp index 643f09db9..43346a4d0 100644 --- a/src/modules/m_operprefix.cpp +++ b/src/modules/m_operprefix.cpp @@ -81,9 +81,6 @@ class ModuleOperPrefixMode : public Module { ServerInstance->Modules->AddService(opm); - Implementation eventlist[] = { I_OnUserPreJoin, I_OnPostOper }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - /* To give clients a chance to learn about the new prefix we don't give +y to opers * right now. That means if the module was loaded after opers have joined channels * they need to rejoin them in order to get the oper prefix. diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index b29c1c676..e342e7dab 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -49,8 +49,6 @@ class ModuleOverride : public Module // read our config options (main config file) OnRehash(NULL); ServerInstance->SNO->EnableSnomask('v', "OVERRIDE"); - Implementation eventlist[] = { I_OnRehash, I_OnPreMode, I_On005Numeric, I_OnUserPreJoin, I_OnUserPreKick, I_OnPreTopicChange }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void OnRehash(User* user) CXX11_OVERRIDE diff --git a/src/modules/m_passforward.cpp b/src/modules/m_passforward.cpp index 606f62c64..7f3cb6421 100644 --- a/src/modules/m_passforward.cpp +++ b/src/modules/m_passforward.cpp @@ -27,8 +27,6 @@ class ModulePassForward : public Module void init() CXX11_OVERRIDE { OnRehash(NULL); - Implementation eventlist[] = { I_OnPostConnect, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp index 03b69e85d..4f7d9e449 100644 --- a/src/modules/m_password_hash.cpp +++ b/src/modules/m_password_hash.cpp @@ -86,8 +86,6 @@ class ModuleOperHash : public Module OnRehash(NULL); ServerInstance->Modules->AddService(cmd); - Implementation eventlist[] = { I_OnPassCompare }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } ModResult OnPassCompare(Extensible* ex, const std::string &data, const std::string &input, const std::string &hashtype) CXX11_OVERRIDE diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index 36dff7a40..b8e5ea5e8 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -124,8 +124,6 @@ public: void init() CXX11_OVERRIDE { ServerInstance->Modules->AddService(p); - Implementation eventlist[] = { I_OnChannelPreDelete, I_OnPostTopicChange, I_OnRawMode, I_OnRehash, I_OnBackgroundTimer }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); } diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp index c9ffd42a9..1bb28583e 100644 --- a/src/modules/m_randquote.cpp +++ b/src/modules/m_randquote.cpp @@ -38,9 +38,6 @@ class ModuleRandQuote : public Module suffix = conf->getString("suffix"); FileReader reader(conf->getString("file", "quotes")); quotes = reader.GetVector(); - - Implementation eventlist[] = { I_OnUserConnect }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void OnUserConnect(LocalUser* user) CXX11_OVERRIDE diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index 735b27ada..89097ade4 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -123,9 +123,6 @@ class ModuleRedirect : public Module /* Try to add the usermode */ ServerInstance->Modules->AddService(re_u); } - - Implementation eventlist[] = { I_OnUserPreJoin }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE diff --git a/src/modules/m_regonlycreate.cpp b/src/modules/m_regonlycreate.cpp index 6b6e059df..b6f7c2c4f 100644 --- a/src/modules/m_regonlycreate.cpp +++ b/src/modules/m_regonlycreate.cpp @@ -33,12 +33,6 @@ class ModuleRegOnlyCreate : public Module { } - void init() CXX11_OVERRIDE - { - Implementation eventlist[] = { I_OnUserPreJoin }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - } - ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE { if (chan) diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index 19b774f04..43f7065b5 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -207,8 +207,6 @@ class ModuleRemove : public Module ServerInstance->Modules->AddService(cmd1); ServerInstance->Modules->AddService(cmd2); OnRehash(NULL); - Implementation eventlist[] = { I_On005Numeric, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE diff --git a/src/modules/m_repeat.cpp b/src/modules/m_repeat.cpp index 3f0afc571..4591d8ad2 100644 --- a/src/modules/m_repeat.cpp +++ b/src/modules/m_repeat.cpp @@ -352,8 +352,6 @@ class RepeatModule : public Module ServerInstance->Modules->AddService(rm); ServerInstance->Modules->AddService(rm.ChanSet); ServerInstance->Modules->AddService(rm.MemberInfoExt); - Implementation eventlist[] = { I_OnUserPreMessage, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); rm.ReadConfig(); } diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index 9de6b1a0c..21686add3 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -42,8 +42,6 @@ class ModuleRestrictChans : public Module void init() CXX11_OVERRIDE { ReadConfig(); - Implementation eventlist[] = { I_OnUserPreJoin, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void OnRehash(User* user) CXX11_OVERRIDE diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp index bab631b8e..5fae46d83 100644 --- a/src/modules/m_restrictmsg.cpp +++ b/src/modules/m_restrictmsg.cpp @@ -24,11 +24,6 @@ class ModuleRestrictMsg : public Module { public: - void init() CXX11_OVERRIDE - { - ServerInstance->Modules->Attach(I_OnUserPreMessage, this); - } - ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string& text, char status, CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE { if ((target_type == TYPE_USER) && (IS_LOCAL(user))) diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 20366e4e7..7a65947d3 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -227,9 +227,6 @@ class ModuleRLine : public Module ServerInstance->Modules->AddService(r); ServerInstance->XLines->RegisterFactory(&f); - - Implementation eventlist[] = { I_OnUserRegister, I_OnRehash, I_OnUserPostNick, I_OnStats, I_OnBackgroundTimer, I_OnUnloadModule }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } ~ModuleRLine() diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index b17c8795b..cd0417aba 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -64,7 +64,6 @@ class ModuleSaMode : public Module void init() CXX11_OVERRIDE { ServerInstance->Modules->AddService(cmd); - ServerInstance->Modules->Attach(I_OnPreMode, this); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 3f9873415..8b6d4ed85 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -257,8 +257,6 @@ class ModuleSASL : public Module void init() CXX11_OVERRIDE { OnRehash(NULL); - Implementation eventlist[] = { I_OnEvent, I_OnUserRegister, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); ServiceProvider* providelist[] = { &auth, &sasl, &authExt }; ServerInstance->Modules->AddServices(providelist, 3); diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index 434261021..cfafd4f05 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -30,8 +30,6 @@ class ModuleSecureList : public Module void init() CXX11_OVERRIDE { OnRehash(NULL); - Implementation eventlist[] = { I_OnRehash, I_OnPreCommand, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_seenicks.cpp b/src/modules/m_seenicks.cpp index 7eefebf4b..bff3516f1 100644 --- a/src/modules/m_seenicks.cpp +++ b/src/modules/m_seenicks.cpp @@ -27,8 +27,6 @@ class ModuleSeeNicks : public Module void init() CXX11_OVERRIDE { ServerInstance->SNO->EnableSnomask('n',"NICK"); - Implementation eventlist[] = { I_OnUserPostNick }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_serverban.cpp b/src/modules/m_serverban.cpp index 070d9d6f2..87fe08670 100644 --- a/src/modules/m_serverban.cpp +++ b/src/modules/m_serverban.cpp @@ -22,12 +22,6 @@ class ModuleServerBan : public Module { public: - void init() CXX11_OVERRIDE - { - Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - } - Version GetVersion() CXX11_OVERRIDE { return Version("Extban 's' - server ban",VF_OPTCOMMON|VF_VENDOR); diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 077f04ab8..4f2125a97 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -120,10 +120,6 @@ class ModuleServicesAccount : public Module { ServiceProvider* providerlist[] = { &m1, &m2, &m3, &m4, &m5, &accountname }; ServerInstance->Modules->AddServices(providerlist, sizeof(providerlist)/sizeof(ServiceProvider*)); - Implementation eventlist[] = { I_OnWhois, I_OnUserPreMessage, I_OnUserPreJoin, I_OnCheckBan, - I_OnDecodeMetaData, I_On005Numeric, I_OnUserPostNick, I_OnSetConnectClass }; - - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp index 5edec41e8..2b550408c 100644 --- a/src/modules/m_servprotect.cpp +++ b/src/modules/m_servprotect.cpp @@ -54,8 +54,6 @@ class ModuleServProtectMode : public Module void init() CXX11_OVERRIDE { ServerInstance->Modules->AddService(bm); - Implementation eventlist[] = { I_OnWhois, I_OnKill, I_OnWhoisLine, I_OnRawMode, I_OnUserPreKick }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index 87092f42f..636f2ff6b 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -78,8 +78,6 @@ class ModuleSetHost : public Module { OnRehash(NULL); ServerInstance->Modules->AddService(cmd); - Implementation eventlist[] = { I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void OnRehash(User* user) CXX11_OVERRIDE diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp index 5291ae595..bf3028c12 100644 --- a/src/modules/m_showwhois.cpp +++ b/src/modules/m_showwhois.cpp @@ -87,8 +87,6 @@ class ModuleShowwhois : public Module sw = new SeeWhois(this, OpersOnly); ServerInstance->Modules->AddService(*sw); ServerInstance->Modules->AddService(cmd); - Implementation eventlist[] = { I_OnWhois }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } ~ModuleShowwhois() diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index d3baffefb..dbc1812c7 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -182,8 +182,6 @@ class ModuleShun : public Module ServerInstance->XLines->RegisterFactory(&f); ServerInstance->Modules->AddService(cmd); - Implementation eventlist[] = { I_OnStats, I_OnPreCommand, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); OnRehash(NULL); } diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 1169d0d54..b6cb897e7 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -305,9 +305,6 @@ class ModuleSilence : public Module ServerInstance->Modules->AddService(cmdsilence); ServerInstance->Modules->AddService(cmdsvssilence); ServerInstance->Modules->AddService(cmdsilence.ext); - - Implementation eventlist[] = { I_OnRehash, I_On005Numeric, I_OnUserPreMessage, I_OnUserPreInvite }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void OnRehash(User* user) CXX11_OVERRIDE diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 3c82d9de0..59e17f88e 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -71,17 +71,6 @@ void ModuleSpanningTree::init() ServerInstance->Modules->AddService(commands->fident); ServerInstance->Modules->AddService(commands->fname); - Implementation eventlist[] = - { - I_OnPreCommand, I_OnGetServerDescription, I_OnUserInvite, I_OnPostTopicChange, - I_OnUserMessage, I_OnBackgroundTimer, I_OnUserJoin, - I_OnChangeHost, I_OnChangeName, I_OnChangeIdent, I_OnUserPart, I_OnUnloadModule, - I_OnUserQuit, I_OnUserPostNick, I_OnUserKick, I_OnRehash, I_OnPreRehash, - I_OnOper, I_OnAddLine, I_OnDelLine, I_OnLoadModule, I_OnStats, - I_OnSetAway, I_OnPostCommand, I_OnUserConnect, I_OnAcceptConnection - }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - delete ServerInstance->PI; ServerInstance->PI = new SpanningTreeProtocolInterface(Utils); loopCall = false; diff --git a/src/modules/m_sqlauth.cpp b/src/modules/m_sqlauth.cpp index 94f2823c9..ba969e54d 100644 --- a/src/modules/m_sqlauth.cpp +++ b/src/modules/m_sqlauth.cpp @@ -85,8 +85,6 @@ class ModuleSQLAuth : public Module { ServerInstance->Modules->AddService(pendingExt); OnRehash(NULL); - Implementation eventlist[] = { I_OnCheckReady, I_OnRehash, I_OnUserRegister }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void OnRehash(User* user) CXX11_OVERRIDE diff --git a/src/modules/m_sqloper.cpp b/src/modules/m_sqloper.cpp index b59225ee8..b9a883043 100644 --- a/src/modules/m_sqloper.cpp +++ b/src/modules/m_sqloper.cpp @@ -114,9 +114,6 @@ public: void init() CXX11_OVERRIDE { OnRehash(NULL); - - Implementation eventlist[] = { I_OnRehash, I_OnPreCommand }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void OnRehash(User* user) CXX11_OVERRIDE diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index 4576e4ef3..c6fb2165c 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -151,9 +151,6 @@ class ModuleSSLInfo : public Module ServerInstance->Modules->AddService(APIImpl); ServerInstance->Modules->AddService(cmd); ServerInstance->Modules->AddService(cmd.CertExt); - - Implementation eventlist[] = { I_OnWhois, I_OnPreCommand, I_OnSetConnectClass, I_OnUserConnect, I_OnPostConnect }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } Version GetVersion() CXX11_OVERRIDE diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index 1d29bb5e1..191ca10f1 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -94,8 +94,6 @@ class ModuleSSLModes : public Module void init() CXX11_OVERRIDE { ServerInstance->Modules->AddService(sslm); - Implementation eventlist[] = { I_OnUserPreJoin, I_OnCheckBan, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index ba66d17b5..b50c22297 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -52,8 +52,6 @@ class ModuleStripColor : public Module { ServerInstance->Modules->AddService(usc); ServerInstance->Modules->AddService(csc); - Implementation eventlist[] = { I_OnUserPreMessage, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index bdabd4b93..fc1eb5381 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -158,8 +158,6 @@ class ModuleSVSHold : public Module { ServerInstance->XLines->RegisterFactory(&s); ServerInstance->Modules->AddService(cmd); - Implementation eventlist[] = { I_OnUserPreNick, I_OnStats }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } ModResult OnStats(char symbol, User* user, string_list &out) CXX11_OVERRIDE diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index 936a18ee4..c2659f6aa 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -92,8 +92,6 @@ class ModuleSWhois : public Module { ServerInstance->Modules->AddService(cmd); ServerInstance->Modules->AddService(cmd.swhois); - Implementation eventlist[] = { I_OnWhoisLine, I_OnPostOper }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } // :kenny.chatspike.net 320 Brain Azhrarn :is getting paid to play games. diff --git a/src/modules/m_testnet.cpp b/src/modules/m_testnet.cpp index 29cb7ed86..4e99abd32 100644 --- a/src/modules/m_testnet.cpp +++ b/src/modules/m_testnet.cpp @@ -19,157 +19,6 @@ #include "inspircd.h" -struct vtbase -{ - virtual void isok(const char* name, int impl, Module* basemod, std::vector<std::string>& allmods) = 0; - virtual ~vtbase() {} -}; - -template<typename T> struct vtable : public vtbase -{ - union u { - T function; - struct v { - size_t delta; - size_t vtoff; - } v; - } u; - vtable(T t) { - u.function = t; - } - /** member function pointer dereference from vtable; depends on the GCC 4.4 ABI (x86_64) */ - template<typename E> void* read(E* obj) - { - if (u.v.delta & 1) - { - uint8_t* optr = reinterpret_cast<uint8_t*>(obj); - optr += u.v.vtoff; - uint8_t* vptr = *reinterpret_cast<uint8_t**>(optr); - vptr += u.v.delta - 1; - return *reinterpret_cast<void**>(vptr); - } - else - return reinterpret_cast<void*>(u.v.delta); - } - void isok(const char* name, int impl, Module* basemod, std::vector<std::string>& allmods) - { - void* base = read(basemod); - for(unsigned int i=0; i < allmods.size(); ++i) - { - Module* mod = ServerInstance->Modules->Find(allmods[i]); - void* fptr = read(mod); - for(EventHandlerIter j = ServerInstance->Modules->EventHandlers[impl].begin(); - j != ServerInstance->Modules->EventHandlers[impl].end(); j++) - { - if (mod == *j) - { - if (fptr == base) - { - ServerInstance->SNO->WriteToSnoMask('a', "Module %s implements %s but uses default function", - mod->ModuleSourceFile.c_str(), name); - } - goto done; - } - } - if (fptr != base) - { - ServerInstance->SNO->WriteToSnoMask('a', "Module %s does not implement %s but overrides function", - mod->ModuleSourceFile.c_str(), name); - } - done:; - } - } -}; - -template<typename T> vtbase* vtinit(T t) -{ - return new vtable<T>(t); -} - -static void checkall(Module* noimpl) -{ - std::vector<std::string> allmods = ServerInstance->Modules->GetAllModuleNames(0); -#define CHK(name) do { \ - vtbase* vt = vtinit(&Module::name); \ - vt->isok(#name, I_ ## name, noimpl, allmods); \ - delete vt; \ -} while (0) - CHK(OnUserConnect); - CHK(OnUserQuit); - CHK(OnUserDisconnect); - CHK(OnUserJoin); - CHK(OnUserPart); - CHK(OnRehash); - CHK(OnSendSnotice); - CHK(OnUserPreJoin); - CHK(OnUserPreKick); - CHK(OnUserKick); - CHK(OnOper); - CHK(OnInfo); - CHK(OnWhois); - CHK(OnUserPreInvite); - CHK(OnUserInvite); - CHK(OnUserPreMessage); - CHK(OnUserPreNick); - CHK(OnUserMessage); - CHK(OnMode); - CHK(OnGetServerDescription); - CHK(OnSyncUser); - CHK(OnSyncChannel); - CHK(OnDecodeMetaData); - CHK(OnAcceptConnection); - CHK(OnChangeHost); - CHK(OnChangeName); - CHK(OnAddLine); - CHK(OnDelLine); - CHK(OnExpireLine); - CHK(OnUserPostNick); - CHK(OnPreMode); - CHK(On005Numeric); - CHK(OnKill); - CHK(OnLoadModule); - CHK(OnUnloadModule); - CHK(OnBackgroundTimer); - CHK(OnPreCommand); - CHK(OnCheckReady); - CHK(OnCheckInvite); - CHK(OnRawMode); - CHK(OnCheckKey); - CHK(OnCheckLimit); - CHK(OnCheckBan); - CHK(OnCheckChannelBan); - CHK(OnExtBanCheck); - CHK(OnStats); - CHK(OnChangeLocalUserHost); - CHK(OnPreTopicChange); - CHK(OnPostTopicChange); - CHK(OnEvent); - CHK(OnGlobalOper); - CHK(OnPostConnect); - CHK(OnChangeLocalUserGECOS); - CHK(OnUserRegister); - CHK(OnChannelPreDelete); - CHK(OnChannelDelete); - CHK(OnPostOper); - CHK(OnSyncNetwork); - CHK(OnSetAway); - CHK(OnPostCommand); - CHK(OnPostJoin); - CHK(OnWhoisLine); - CHK(OnBuildNeighborList); - CHK(OnGarbageCollect); - CHK(OnText); - CHK(OnPassCompare); - CHK(OnRunTestSuite); - CHK(OnNamesListItem); - CHK(OnNumeric); - CHK(OnHookIO); - CHK(OnPreRehash); - CHK(OnModuleRehash); - CHK(OnSendWhoLine); - CHK(OnChangeIdent); -} - class CommandTest : public Command { public: @@ -191,11 +40,6 @@ class CommandTest : public Command { IS_LOCAL(user)->CommandFloodPenalty += atoi(parameters[1].c_str()); } - else if (parameters[0] == "check") - { - checkall(creator); - ServerInstance->SNO->WriteToSnoMask('a', "Module check complete"); - } return CMD_SUCCESS; } }; diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 6a885a2fe..afb042da0 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -151,8 +151,6 @@ class ModuleTimedBans : public Module void init() CXX11_OVERRIDE { ServerInstance->Modules->AddService(cmd); - Implementation eventlist[] = { I_OnBackgroundTimer }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); ServerInstance->Modes->AddModeWatcher(&banwatcher); } diff --git a/src/modules/m_topiclock.cpp b/src/modules/m_topiclock.cpp index 4a10f0fe3..760283c95 100644 --- a/src/modules/m_topiclock.cpp +++ b/src/modules/m_topiclock.cpp @@ -153,7 +153,6 @@ class ModuleTopicLock : public Module { ServerInstance->Modules->AddService(cmd); ServerInstance->Modules->AddService(topiclock); - ServerInstance->Modules->Attach(I_OnPreTopicChange, this); } ModResult OnPreTopicChange(User* user, Channel* chan, const std::string &topic) CXX11_OVERRIDE diff --git a/src/modules/m_uhnames.cpp b/src/modules/m_uhnames.cpp index ba994404a..2534afb97 100644 --- a/src/modules/m_uhnames.cpp +++ b/src/modules/m_uhnames.cpp @@ -31,12 +31,6 @@ class ModuleUHNames : public Module { } - void init() CXX11_OVERRIDE - { - Implementation eventlist[] = { I_OnEvent, I_OnPreCommand, I_OnNamesListItem, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); - } - Version GetVersion() CXX11_OVERRIDE { return Version("Provides the UHNAMES facility.",VF_VENDOR); diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index b2206220d..97e4c9284 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -88,8 +88,6 @@ class ModuleUserIP : public Module void init() CXX11_OVERRIDE { ServerInstance->Modules->AddService(cmd); - Implementation eventlist[] = { I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index c6b580277..94f53c164 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -380,8 +380,6 @@ class Modulewatch : public Module ServerInstance->Modules->AddService(cmdw); ServerInstance->Modules->AddService(sw); ServerInstance->Modules->AddService(cmdw.ext); - Implementation eventlist[] = { I_OnRehash, I_OnGarbageCollect, I_OnUserQuit, I_OnPostConnect, I_OnUserPostNick, I_On005Numeric, I_OnSetAway }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void OnRehash(User* user) CXX11_OVERRIDE diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp index 26c108609..df6f4c10c 100644 --- a/src/modules/m_xline_db.cpp +++ b/src/modules/m_xline_db.cpp @@ -41,8 +41,6 @@ class ModuleXLineDB : public Module // Read xlines before attaching to events ReadDatabase(); - Implementation eventlist[] = { I_OnAddLine, I_OnDelLine, I_OnExpireLine, I_OnBackgroundTimer }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); dirty = false; } |