From: Adam Date: Wed, 26 Jun 2013 21:01:33 +0000 (-0400) Subject: Change the syntax of FOREACH macros to be less dumb. X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=8710724b5518ae9858309e548514f76e620a8459;p=user%2Fhenk%2Fcode%2Finspircd.git Change the syntax of FOREACH macros to be less dumb. --- diff --git a/include/modules.h b/include/modules.h index 8ef646a08..52e41a1fc 100644 --- a/include/modules.h +++ b/include/modules.h @@ -119,17 +119,18 @@ struct ModResult { /** * This #define allows us to call a method in all * loaded modules in a readable simple way, e.g.: - * 'FOREACH_MOD(I_OnConnect,OnConnect(user));' + * 'FOREACH_MOD(OnConnect,(user));' */ #define FOREACH_MOD(y,x) do { \ EventHandlerIter safei; \ - for (EventHandlerIter _i = ServerInstance->Modules->EventHandlers[y].begin(); _i != ServerInstance->Modules->EventHandlers[y].end(); ) \ + IntModuleList& _handlers = ServerInstance->Modules->EventHandlers[I_ ## y]; \ + for (EventHandlerIter _i = _handlers.begin(); _i != _handlers.end(); ) \ { \ safei = _i; \ ++safei; \ try \ { \ - (*_i)->x ; \ + (*_i)->y x ; \ } \ catch (CoreException& modexcept) \ { \ @@ -147,21 +148,18 @@ struct ModResult { */ #define DO_EACH_HOOK(n,v,args) \ do { \ - EventHandlerIter iter_ ## n = ServerInstance->Modules->EventHandlers[I_ ## n].begin(); \ - while (iter_ ## n != ServerInstance->Modules->EventHandlers[I_ ## n].end()) \ + IntModuleList& _handlers = ServerInstance->Modules->EventHandlers[I_ ## n]; \ + for (EventHandlerIter _i = _handlers.begin(); _i != _handlers.end(); ++_i) \ { \ - Module* mod_ ## n = *iter_ ## n; \ - iter_ ## n ++; \ try \ { \ - v = (mod_ ## n)->n args; + v = (*_i)->n args; #define WHILE_EACH_HOOK(n) \ } \ catch (CoreException& except_ ## n) \ { \ ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "Exception caught: %s", (except_ ## n).GetReason()); \ - (void) mod_ ## n; /* catch mismatched pairs */ \ } \ } \ } while(0) diff --git a/src/channels.cpp b/src/channels.cpp index e9e2a3020..d82ad6c23 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -86,7 +86,7 @@ void Channel::SetTopic(User* u, const std::string& ntopic) this->WriteChannel(u, "TOPIC %s :%s", this->name.c_str(), this->topic.c_str()); this->topicset = ServerInstance->Time(); - FOREACH_MOD(I_OnPostTopicChange,OnPostTopicChange(u, this, this->topic)); + FOREACH_MOD(OnPostTopicChange, (u, this, this->topic)); } Membership* Channel::AddUser(User* user) @@ -120,7 +120,7 @@ void Channel::CheckDestroy() /* kill the record */ if (iter != ServerInstance->chanlist->end()) { - FOREACH_MOD(I_OnChannelDelete, OnChannelDelete(this)); + FOREACH_MOD(OnChannelDelete, (this)); ServerInstance->chanlist->erase(iter); } @@ -355,7 +355,7 @@ void Channel::ForceJoin(User* user, const std::string* privs, bool bursting, boo // Tell modules about this join, they have the chance now to populate except_list with users we won't send the JOIN (and possibly MODE) to CUList except_list; - FOREACH_MOD(I_OnUserJoin,OnUserJoin(memb, bursting, created_by_local, except_list)); + FOREACH_MOD(OnUserJoin, (memb, bursting, created_by_local, except_list)); this->WriteAllExcept(user, false, 0, except_list, "JOIN :%s", this->name.c_str()); @@ -380,7 +380,7 @@ void Channel::ForceJoin(User* user, const std::string* privs, bool bursting, boo this->UserList(user); } - FOREACH_MOD(I_OnPostJoin,OnPostJoin(memb)); + FOREACH_MOD(OnPostJoin, (memb)); } bool Channel::IsBanned(User* user) @@ -465,7 +465,7 @@ void Channel::PartUser(User *user, std::string &reason) { Membership* memb = membiter->second; CUList except_list; - FOREACH_MOD(I_OnUserPart,OnUserPart(memb, reason, except_list)); + FOREACH_MOD(OnUserPart, (memb, reason, except_list)); WriteAllExcept(user, false, 0, except_list, "PART %s%s%s", this->name.c_str(), reason.empty() ? "" : " :", reason.c_str()); @@ -520,7 +520,7 @@ void Channel::KickUser(User* src, User* victim, const std::string& reason, Membe } CUList except_list; - FOREACH_MOD(I_OnUserKick,OnUserKick(src, memb, reason, except_list)); + FOREACH_MOD(OnUserKick, (src, memb, reason, except_list)); WriteAllExcept(src, false, 0, except_list, "KICK %s %s :%s", name.c_str(), victim->nick.c_str(), reason.c_str()); @@ -696,7 +696,7 @@ void Channel::UserList(User *user) prefixlist = this->GetPrefixChar(i->first); nick = i->first->nick; - FOREACH_MOD(I_OnNamesListItem, OnNamesListItem(user, i->second, prefixlist, nick)); + FOREACH_MOD(OnNamesListItem, (user, i->second, prefixlist, nick)); /* Nick was nuked, a module wants us to skip it */ if (nick.empty()) diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 457934d2b..51358519b 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -100,7 +100,7 @@ bool CommandParser::LoopCall(User* user, Command* handler, const std::vectorHandle(command_p, user); - FOREACH_MOD(I_OnPostCommand, OnPostCommand(handler, command_p, user, result, cmd)); + FOREACH_MOD(OnPostCommand, (handler, command_p, user, result, cmd)); } } diff --git a/src/commands/cmd_info.cpp b/src/commands/cmd_info.cpp index 6e5f2a909..b3f146c30 100644 --- a/src/commands/cmd_info.cpp +++ b/src/commands/cmd_info.cpp @@ -100,7 +100,7 @@ CmdResult CommandInfo::Handle (const std::vector& parameters, User int i=0; while (lines[i]) user->SendText(":%s %03d %s :%s", ServerInstance->Config->ServerName.c_str(), RPL_INFO, user->nick.c_str(), lines[i++]); - FOREACH_MOD(I_OnInfo,OnInfo(user)); + FOREACH_MOD(OnInfo, (user)); user->SendText(":%s %03d %s :End of /INFO list", ServerInstance->Config->ServerName.c_str(), RPL_ENDOFINFO, user->nick.c_str()); return CMD_SUCCESS; } diff --git a/src/commands/cmd_invite.cpp b/src/commands/cmd_invite.cpp index 355bde9e6..2ed05c550 100644 --- a/src/commands/cmd_invite.cpp +++ b/src/commands/cmd_invite.cpp @@ -143,7 +143,7 @@ CmdResult CommandInvite::Handle (const std::vector& parameters, Use } c->WriteAllExceptSender(user, true, prefix, "NOTICE %s :*** %s invited %s into the channel", c->name.c_str(), user->nick.c_str(), u->nick.c_str()); } - FOREACH_MOD(I_OnUserInvite,OnUserInvite(user,u,c,timeout)); + FOREACH_MOD(OnUserInvite, (user,u,c,timeout)); } else if (IS_LOCAL(user)) { diff --git a/src/commands/cmd_privmsg.cpp b/src/commands/cmd_privmsg.cpp index 5519be2fa..ed98c771f 100644 --- a/src/commands/cmd_privmsg.cpp +++ b/src/commands/cmd_privmsg.cpp @@ -84,12 +84,12 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector& para const char* text = temp.c_str(); const char* servermask = (parameters[0].c_str()) + 1; - FOREACH_MOD(I_OnText,OnText(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, except_list)); + FOREACH_MOD(OnText, (user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, except_list)); if (InspIRCd::Match(ServerInstance->Config->ServerName, servermask, NULL)) { user->SendAll(MessageTypeString[mt], "%s", text); } - FOREACH_MOD(I_OnUserMessage,OnUserMessage(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, except_list, mt)); + FOREACH_MOD(OnUserMessage, (user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, except_list, mt)); return CMD_SUCCESS; } char status = 0; @@ -147,7 +147,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector& para return CMD_FAILURE; } - FOREACH_MOD(I_OnText,OnText(user,chan,TYPE_CHANNEL,text,status,except_list)); + FOREACH_MOD(OnText, (user,chan,TYPE_CHANNEL,text,status,except_list)); if (status) { @@ -165,7 +165,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector& para chan->WriteAllExcept(user, false, status, except_list, "%s %s :%s", MessageTypeString[mt], chan->name.c_str(), text); } - FOREACH_MOD(I_OnUserMessage, OnUserMessage(user,chan, TYPE_CHANNEL, text, status, except_list, mt)); + FOREACH_MOD(OnUserMessage, (user,chan, TYPE_CHANNEL, text, status, except_list, mt)); } else { @@ -224,7 +224,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector& para const char* text = temp.c_str(); - FOREACH_MOD(I_OnText,OnText(user, dest, TYPE_USER, text, 0, except_list)); + FOREACH_MOD(OnText, (user, dest, TYPE_USER, text, 0, except_list)); if (IS_LOCAL(dest)) { @@ -232,7 +232,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector& para user->WriteTo(dest, "%s %s :%s", MessageTypeString[mt], dest->nick.c_str(), text); } - FOREACH_MOD(I_OnUserMessage,OnUserMessage(user, dest, TYPE_USER, text, 0, except_list, mt)); + FOREACH_MOD(OnUserMessage, (user, dest, TYPE_USER, text, 0, except_list, mt)); } else { diff --git a/src/commands/cmd_rehash.cpp b/src/commands/cmd_rehash.cpp index 923bfe129..3dc454036 100644 --- a/src/commands/cmd_rehash.cpp +++ b/src/commands/cmd_rehash.cpp @@ -45,7 +45,7 @@ CmdResult CommandRehash::Handle (const std::vector& parameters, Use { std::string param = parameters.size() ? parameters[0] : ""; - FOREACH_MOD(I_OnPreRehash,OnPreRehash(user, param)); + FOREACH_MOD(OnPreRehash, (user, param)); if (param.empty()) { @@ -68,7 +68,7 @@ CmdResult CommandRehash::Handle (const std::vector& parameters, Use if (param[0] == '-') param = param.substr(1); - FOREACH_MOD(I_OnModuleRehash,OnModuleRehash(user, param)); + FOREACH_MOD(OnModuleRehash, (user, param)); return CMD_SUCCESS; } @@ -88,7 +88,7 @@ CmdResult CommandRehash::Handle (const std::vector& parameters, Use /* Don't do anything with the logs here -- logs are restarted * after the config thread has completed. */ - FOREACH_MOD(I_OnGarbageCollect, OnGarbageCollect()); + FOREACH_MOD(OnGarbageCollect, ()); ServerInstance->ConfigThread = new ConfigReaderThread(user->uuid); diff --git a/src/commands/cmd_who.cpp b/src/commands/cmd_who.cpp index 302393927..5e0e55b66 100644 --- a/src/commands/cmd_who.cpp +++ b/src/commands/cmd_who.cpp @@ -229,7 +229,7 @@ void CommandWho::SendWhoLine(User* user, const std::vector& parms, wholine.append(" :0 " + u->fullname); - FOREACH_MOD(I_OnSendWhoLine, OnSendWhoLine(user, parms, u, wholine)); + FOREACH_MOD(OnSendWhoLine, (user, parms, u, wholine)); if (!wholine.empty()) whoresults.push_back(wholine); diff --git a/src/commands/cmd_whois.cpp b/src/commands/cmd_whois.cpp index 116e43135..f75bd13fe 100644 --- a/src/commands/cmd_whois.cpp +++ b/src/commands/cmd_whois.cpp @@ -173,7 +173,7 @@ void CommandWhois::DoWhois(User* user, User* dest, unsigned long signon, unsigne } } - FOREACH_MOD(I_OnWhois,OnWhois(user,dest)); + FOREACH_MOD(OnWhois, (user,dest)); /* * We only send these if we've been provided them. That is, if hidewhois is turned off, and user is local, or diff --git a/src/configreader.cpp b/src/configreader.cpp index b8c54bef9..d2291556c 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -829,7 +829,7 @@ void ConfigReaderThread::Finish() static_cast(*ban)->DoRehash(); Config->ApplyDisabledCommands(Config->DisabledCommands); User* user = ServerInstance->FindNick(TheUserUID); - FOREACH_MOD(I_OnRehash, OnRehash(user)); + FOREACH_MOD(OnRehash, (user)); ServerInstance->ISupport.Build(); ServerInstance->Logs->CloseLogs(); diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index f70e04d95..2626da6bb 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -36,7 +36,7 @@ std::string InspIRCd::GetServerDescription(const std::string& servername) { std::string description; - FOREACH_MOD(I_OnGetServerDescription,OnGetServerDescription(servername,description)); + FOREACH_MOD(OnGetServerDescription, (servername,description)); if (!description.empty()) { diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 48746cb52..78659089c 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -701,7 +701,7 @@ void InspIRCd::Run() if ((TIME.tv_sec % 3600) == 0) { Users->GarbageCollect(); - FOREACH_MOD(I_OnGarbageCollect, OnGarbageCollect()); + FOREACH_MOD(OnGarbageCollect, ()); } Timers->TickTimers(TIME.tv_sec); @@ -709,7 +709,7 @@ void InspIRCd::Run() if ((TIME.tv_sec % 5) == 0) { - FOREACH_MOD(I_OnBackgroundTimer,OnBackgroundTimer(TIME.tv_sec)); + FOREACH_MOD(OnBackgroundTimer, (TIME.tv_sec)); SNO->FlushSnotices(); } } diff --git a/src/mode.cpp b/src/mode.cpp index 8eb1020a8..3206e5638 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -475,7 +475,7 @@ void ModeParser::Process(const std::vector& parameters, User* user, else targetuser->WriteFrom(user, "MODE " + LastParse); - FOREACH_MOD(I_OnMode,OnMode(user, targetuser, targetchannel, LastParseParams, LastParseTranslate)); + FOREACH_MOD(OnMode, (user, targetuser, targetchannel, LastParseParams, LastParseTranslate)); } else if (targetchannel && parameters.size() == 2) { diff --git a/src/modmanager_dynamic.cpp b/src/modmanager_dynamic.cpp index b9c046a8e..a4a3ddb0b 100644 --- a/src/modmanager_dynamic.cpp +++ b/src/modmanager_dynamic.cpp @@ -108,7 +108,7 @@ bool ModuleManager::Load(const std::string& filename, bool defer) if (defer) return true; - FOREACH_MOD(I_OnLoadModule,OnLoadModule(newmod)); + FOREACH_MOD(OnLoadModule, (newmod)); /* We give every module a chance to re-prioritize when we introduce a new one, * not just the one thats loading, as the new module could affect the preference * of others diff --git a/src/modmanager_static.cpp b/src/modmanager_static.cpp index 44c36919b..40123674b 100644 --- a/src/modmanager_static.cpp +++ b/src/modmanager_static.cpp @@ -112,7 +112,7 @@ bool ModuleManager::Load(const std::string& name, bool defer) ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "Unable to load " + name + ": " + modexcept.GetReason()); return false; } - FOREACH_MOD(I_OnLoadModule,OnLoadModule(mod)); + FOREACH_MOD(OnLoadModule, (mod)); /* We give every module a chance to re-prioritize when we introduce a new one, * not just the one thats loading, as the new module could affect the preference * of others diff --git a/src/modules.cpp b/src/modules.cpp index ca312c4a5..26e91f876 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -62,7 +62,7 @@ Event::Event(Module* src, const std::string &eventid) : source(src), id(eventid) void Event::Send() { - FOREACH_MOD(I_OnEvent,OnEvent(*this)); + FOREACH_MOD(OnEvent, (*this)); } // These declarations define the behavours of the base class Module (which does nothing at all) @@ -329,7 +329,7 @@ void ModuleManager::DoSafeUnload(Module* mod) // First, notify all modules that a module is about to be unloaded, so in case // they pass execution to the soon to be unloaded module, it will happen now, // i.e. before we unregister the services of the module being unloaded - FOREACH_MOD(I_OnUnloadModule,OnUnloadModule(mod)); + FOREACH_MOD(OnUnloadModule, (mod)); std::map::iterator modfind = Modules.find(mod->ModuleSourceFile); diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 044af04ea..258352979 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -220,7 +220,7 @@ class CommandCheck : public Command banlm->DoSyncChannel(targchan, creator, user); // Show other listmodes as well - FOREACH_MOD(I_OnSyncChannel,OnSyncChannel(targchan,creator,user)); + FOREACH_MOD(OnSyncChannel, (targchan,creator,user)); dumpExt(user, checkstr, targchan); } else diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index a04abd5e6..bb5d5c0b0 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -63,7 +63,7 @@ class HttpServerSocket : public BufferedSocket { InternalState = HTTP_SERVE_WAIT_REQUEST; - FOREACH_MOD(I_OnHookIO, OnHookIO(this, via)); + FOREACH_MOD(OnHookIO, (this, via)); if (GetIOHook()) GetIOHook()->OnStreamSocketAccept(this, client, server); } diff --git a/src/modules/m_ircv3.cpp b/src/modules/m_ircv3.cpp index 7e8a1a8ff..643e6a7b3 100644 --- a/src/modules/m_ircv3.cpp +++ b/src/modules/m_ircv3.cpp @@ -36,7 +36,7 @@ class ModuleIRCv3 : public Module UserChanList chans(user->chans); std::map exceptions; - FOREACH_MOD(I_OnBuildNeighborList, OnBuildNeighborList(user, chans, exceptions)); + FOREACH_MOD(OnBuildNeighborList, (user, chans, exceptions)); // Send it to all local users who were explicitly marked as neighbours by modules and have the required ext for (std::map::const_iterator i = exceptions.begin(); i != exceptions.end(); ++i) diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index 704745f57..36dff7a40 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -145,7 +145,7 @@ public: { chan_hash::iterator at = iter; iter++; - FOREACH_MOD(I_OnChannelDelete, OnChannelDelete(c)); + FOREACH_MOD(OnChannelDelete, (c)); ServerInstance->chanlist->erase(at); ServerInstance->GlobalCulls.AddItem(c); } diff --git a/src/modules/m_spanningtree/away.cpp b/src/modules/m_spanningtree/away.cpp index f2cabadd5..ae60633bf 100644 --- a/src/modules/m_spanningtree/away.cpp +++ b/src/modules/m_spanningtree/away.cpp @@ -30,7 +30,7 @@ bool TreeSocket::Away(const std::string &prefix, parameterlist ¶ms) return true; if (params.size()) { - FOREACH_MOD(I_OnSetAway, OnSetAway(u, params[params.size() - 1])); + FOREACH_MOD(OnSetAway, (u, params[params.size() - 1])); if (params.size() > 1) u->awaytime = ConvToInt(params[0]); @@ -43,7 +43,7 @@ bool TreeSocket::Away(const std::string &prefix, parameterlist ¶ms) } else { - FOREACH_MOD(I_OnSetAway, OnSetAway(u, "")); + FOREACH_MOD(OnSetAway, (u, "")); u->awaymsg.clear(); } Utils->DoOneToAllButSender(prefix,"AWAY",params,u->server); diff --git a/src/modules/m_spanningtree/metadata.cpp b/src/modules/m_spanningtree/metadata.cpp index 9709ca54c..8ce41d87f 100644 --- a/src/modules/m_spanningtree/metadata.cpp +++ b/src/modules/m_spanningtree/metadata.cpp @@ -26,7 +26,7 @@ CmdResult CommandMetadata::Handle(const std::vector& params, User * if (params[0] == "*") { std::string value = params.size() < 3 ? "" : params[2]; - FOREACH_MOD(I_OnDecodeMetaData,OnDecodeMetaData(NULL,params[1],value)); + FOREACH_MOD(OnDecodeMetaData, (NULL,params[1],value)); return CMD_SUCCESS; } @@ -54,7 +54,7 @@ CmdResult CommandMetadata::Handle(const std::vector& params, User * ExtensionItem* item = ServerInstance->Extensions.GetItem(params[2]); if (item) item->unserialize(FORMAT_NETWORK, c, value); - FOREACH_MOD(I_OnDecodeMetaData,OnDecodeMetaData(c,params[2],value)); + FOREACH_MOD(OnDecodeMetaData, (c,params[2],value)); } else { @@ -66,7 +66,7 @@ CmdResult CommandMetadata::Handle(const std::vector& params, User * if (item) item->unserialize(FORMAT_NETWORK, u, value); - FOREACH_MOD(I_OnDecodeMetaData,OnDecodeMetaData(u,params[1],value)); + FOREACH_MOD(OnDecodeMetaData, (u,params[1],value)); } } diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index aefb9de01..d86115cce 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -51,7 +51,7 @@ void TreeSocket::DoBurst(TreeServer* s) SyncChannel(i->second); this->SendXLines(); - FOREACH_MOD(I_OnSyncNetwork,OnSyncNetwork(Utils->Creator,(void*)this)); + FOREACH_MOD(OnSyncNetwork, (Utils->Creator,(void*)this)); this->WriteLine(":" + ServerInstance->Config->GetSID() + " ENDBURST"); ServerInstance->SNO->WriteToSnoMask('l',"Finished bursting to \2"+ s->GetName()+"\2."); } @@ -167,7 +167,7 @@ void TreeSocket::SyncChannel(Channel* chan) Utils->Creator->ProtoSendMetaData(this, chan, item->name, value); } - FOREACH_MOD(I_OnSyncChannel,OnSyncChannel(chan, Utils->Creator, this)); + FOREACH_MOD(OnSyncChannel, (chan, Utils->Creator, this)); } /** send all users and their oper state/modes */ @@ -212,7 +212,7 @@ void TreeSocket::SendUsers() Utils->Creator->ProtoSendMetaData(this, u->second, item->name, value); } - FOREACH_MOD(I_OnSyncUser,OnSyncUser(u->second,Utils->Creator,this)); + FOREACH_MOD(OnSyncUser, (u->second,Utils->Creator,this)); } } } diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 69dfa3ce3..1c72f3ad7 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -69,7 +69,7 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, int newfd, ListenSocket* via capab = new CapabData; capab->capab_phase = 0; - FOREACH_MOD(I_OnHookIO, OnHookIO(this, via)); + FOREACH_MOD(OnHookIO, (this, via)); if (GetIOHook()) GetIOHook()->OnStreamSocketAccept(this, client, server); SendCapabilities(1); diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index 4204737ca..dd4591a9b 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -148,7 +148,7 @@ CmdResult CommandUID::Handle(const parameterlist ¶ms, User* serversrc) if (dosend) ServerInstance->SNO->WriteToSnoMask('C',"Client connecting at %s: %s (%s) [%s]", _new->server.c_str(), _new->GetFullRealHost().c_str(), _new->GetIPString().c_str(), _new->fullname.c_str()); - FOREACH_MOD(I_OnPostConnect,OnPostConnect(_new)); + FOREACH_MOD(OnPostConnect, (_new)); return CMD_SUCCESS; } diff --git a/src/server.cpp b/src/server.cpp index 580ee5310..efefa0d37 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -58,7 +58,7 @@ void InspIRCd::Exit(int status) void RehashHandler::Call(const std::string &reason) { ServerInstance->SNO->WriteToSnoMask('a', "Rehashing config file %s %s",ServerConfig::CleanFilename(ServerInstance->ConfigFileName.c_str()), reason.c_str()); - FOREACH_MOD(I_OnGarbageCollect, OnGarbageCollect()); + FOREACH_MOD(OnGarbageCollect, ()); if (!ServerInstance->ConfigThread) { ServerInstance->ConfigThread = new ConfigReaderThread(""); @@ -190,7 +190,7 @@ void ISupportManager::Build() tokens["WALLCHOPS"] = tokens["WALLVOICES"]; // Modules can add new tokens and also edit or remove existing tokens - FOREACH_MOD(I_On005Numeric, On005Numeric(tokens)); + FOREACH_MOD(On005Numeric, (tokens)); // EXTBAN is a special case as we need to sort it and prepend a comma. std::map::iterator extban = tokens.find("EXTBAN"); diff --git a/src/snomasks.cpp b/src/snomasks.cpp index fa8e5ab60..d7cb64f26 100644 --- a/src/snomasks.cpp +++ b/src/snomasks.cpp @@ -115,7 +115,7 @@ void Snomask::Flush() std::string desc = GetDescription(LastLetter); std::string msg = "(last message repeated " + ConvToStr(Count) + " times)"; - FOREACH_MOD(I_OnSendSnotice, OnSendSnotice(LastLetter, desc, msg)); + FOREACH_MOD(OnSendSnotice, (LastLetter, desc, msg)); Snomask::Send(LastLetter, desc, msg); } diff --git a/src/testsuite.cpp b/src/testsuite.cpp index efd04cc3f..b27f6e18c 100644 --- a/src/testsuite.cpp +++ b/src/testsuite.cpp @@ -74,7 +74,7 @@ TestSuite::TestSuite() switch (choice) { case '1': - FOREACH_MOD(I_OnRunTestSuite, OnRunTestSuite()); + FOREACH_MOD(OnRunTestSuite, ()); break; case '2': std::cout << "Enter module filename to load: "; diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 15e59c800..605bc1f69 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -63,7 +63,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs UserIOHandler* eh = &New->eh; /* Give each of the modules an attempt to hook the user for I/O */ - FOREACH_MOD(I_OnHookIO, OnHookIO(eh, via)); + FOREACH_MOD(OnHookIO, (eh, via)); if (eh->GetIOHook()) { @@ -162,11 +162,11 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs if (ServerInstance->Config->RawLog) New->WriteNotice("*** Raw I/O logging is enabled on this server. All messages, passwords, and commands are being recorded."); - FOREACH_MOD(I_OnSetUserIP,OnSetUserIP(New)); + FOREACH_MOD(OnSetUserIP, (New)); if (New->quitting) return; - FOREACH_MOD(I_OnUserInit,OnUserInit(New)); + FOREACH_MOD(OnUserInit, (New)); } void UserManager::QuitUser(User *user, const std::string &quitreason, const char* operreason) @@ -200,7 +200,7 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char if (user->registered == REG_ALL) { - FOREACH_MOD(I_OnUserQuit,OnUserQuit(user, reason, oper_reason)); + FOREACH_MOD(OnUserQuit, (user, reason, oper_reason)); user->WriteCommonQuit(reason, oper_reason); } @@ -211,7 +211,7 @@ void UserManager::QuitUser(User *user, const std::string &quitreason, const char if (IS_LOCAL(user)) { LocalUser* lu = IS_LOCAL(user); - FOREACH_MOD(I_OnUserDisconnect,OnUserDisconnect(lu)); + FOREACH_MOD(OnUserDisconnect, (lu)); lu->eh.Close(); } diff --git a/src/users.cpp b/src/users.cpp index fe593a139..0cd92faef 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -374,7 +374,7 @@ void User::Oper(OperInfo* info) this->SetMode(opermh, true); this->oper = info; this->WriteServ("MODE %s :+o", this->nick.c_str()); - FOREACH_MOD(I_OnOper, OnOper(this, info->name)); + FOREACH_MOD(OnOper, (this, info->name)); std::string opername; if (info->oper_block) @@ -402,7 +402,7 @@ void User::Oper(OperInfo* info) if (IS_LOCAL(this)) oper->init(); - FOREACH_MOD(I_OnPostOper,OnPostOper(this, oper->name, opername)); + FOREACH_MOD(OnPostOper, (this, oper->name, opername)); } void OperInfo::init() @@ -608,11 +608,11 @@ void LocalUser::FullConnect() * We don't set REG_ALL until triggering OnUserConnect, so some module events don't spew out stuff * for a user that doesn't exist yet. */ - FOREACH_MOD(I_OnUserConnect,OnUserConnect(this)); + FOREACH_MOD(OnUserConnect, (this)); this->registered = REG_ALL; - FOREACH_MOD(I_OnPostConnect,OnPostConnect(this)); + FOREACH_MOD(OnPostConnect, (this)); ServerInstance->SNO->WriteToSnoMask('c',"Client connecting on port %d (class %s): %s (%s) [%s]", this->GetServerPort(), this->MyClass->name.c_str(), GetFullRealHost().c_str(), this->GetIPString().c_str(), this->fullname.c_str()); @@ -740,7 +740,7 @@ bool User::ChangeNick(const std::string& newnick, bool force) (*(ServerInstance->Users->clientlist))[newnick] = this; if (registered == REG_ALL) - FOREACH_MOD(I_OnUserPostNick,OnUserPostNick(this,oldnick)); + FOREACH_MOD(OnUserPostNick, (this,oldnick)); return true; } @@ -819,7 +819,7 @@ void LocalUser::SetClientIP(const irc::sockets::sockaddrs& sa, bool recheck_elin if (recheck_eline) this->exempt = (ServerInstance->XLines->MatchesLine("E", this) != NULL); - FOREACH_MOD(I_OnSetUserIP,OnSetUserIP(this)); + FOREACH_MOD(OnSetUserIP, (this)); } } @@ -971,7 +971,7 @@ void User::WriteCommonRaw(const std::string &line, bool include_self) exceptions[this] = include_self; - FOREACH_MOD(I_OnBuildNeighborList,OnBuildNeighborList(this, include_c, exceptions)); + FOREACH_MOD(OnBuildNeighborList, (this, include_c, exceptions)); for (std::map::iterator i = exceptions.begin(); i != exceptions.end(); ++i) { @@ -1012,7 +1012,7 @@ void User::WriteCommonQuit(const std::string &normal_text, const std::string &op UserChanList include_c(chans); std::map exceptions; - FOREACH_MOD(I_OnBuildNeighborList,OnBuildNeighborList(this, include_c, exceptions)); + FOREACH_MOD(OnBuildNeighborList, (this, include_c, exceptions)); for (std::map::iterator i = exceptions.begin(); i != exceptions.end(); ++i) { @@ -1117,7 +1117,7 @@ bool User::ChangeName(const char* gecos) FIRST_MOD_RESULT(OnChangeLocalUserGECOS, MOD_RESULT, (IS_LOCAL(this),gecos)); if (MOD_RESULT == MOD_RES_DENY) return false; - FOREACH_MOD(I_OnChangeName,OnChangeName(this,gecos)); + FOREACH_MOD(OnChangeName, (this,gecos)); } this->fullname.assign(gecos, 0, ServerInstance->Config->Limits.MaxGecos); @@ -1135,7 +1135,7 @@ void User::DoHostCycle(const std::string &quitline) UserChanList include_c(chans); std::map exceptions; - FOREACH_MOD(I_OnBuildNeighborList,OnBuildNeighborList(this, include_c, exceptions)); + FOREACH_MOD(OnBuildNeighborList, (this, include_c, exceptions)); for (std::map::iterator i = exceptions.begin(); i != exceptions.end(); ++i) { @@ -1203,7 +1203,7 @@ bool User::ChangeDisplayedHost(const char* shost) return false; } - FOREACH_MOD(I_OnChangeHost, OnChangeHost(this,shost)); + FOREACH_MOD(OnChangeHost, (this,shost)); std::string quitstr = ":" + GetFullHost() + " QUIT :Changing host"; @@ -1225,7 +1225,7 @@ bool User::ChangeIdent(const char* newident) if (this->ident == newident) return true; - FOREACH_MOD(I_OnChangeIdent, OnChangeIdent(this,newident)); + FOREACH_MOD(OnChangeIdent, (this,newident)); std::string quitstr = ":" + GetFullHost() + " QUIT :Changing ident"; diff --git a/src/xline.cpp b/src/xline.cpp index 4bb9551ec..44ae1e98e 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -284,7 +284,7 @@ bool XLineManager::AddLine(XLine* line, User* user) lookup_lines[line->type][line->Displayable().c_str()] = line; line->OnAdd(); - FOREACH_MOD(I_OnAddLine,OnAddLine(user, line)); + FOREACH_MOD(OnAddLine, (user, line)); return true; } @@ -308,7 +308,7 @@ bool XLineManager::DelLine(const char* hostmask, const std::string &type, User* ServerInstance->BanCache->RemoveEntries(y->second->type, true); - FOREACH_MOD(I_OnDelLine,OnDelLine(user, y->second)); + FOREACH_MOD(OnDelLine, (user, y->second)); y->second->Unset(); @@ -409,7 +409,7 @@ XLine* XLineManager::MatchesLine(const std::string &type, const std::string &pat // removes lines that have expired void XLineManager::ExpireLine(ContainerIter container, LookupIter item) { - FOREACH_MOD(I_OnExpireLine, OnExpireLine(item->second)); + FOREACH_MOD(OnExpireLine, (item->second)); item->second->DisplayExpiry(); item->second->Unset();