]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Change the syntax of FOREACH macros to be less dumb.
authorAdam <Adam@anope.org>
Wed, 26 Jun 2013 21:01:33 +0000 (17:01 -0400)
committerattilamolnar <attilamolnar@hush.com>
Sun, 4 Aug 2013 14:08:57 +0000 (16:08 +0200)
31 files changed:
include/modules.h
src/channels.cpp
src/command_parse.cpp
src/commands/cmd_info.cpp
src/commands/cmd_invite.cpp
src/commands/cmd_privmsg.cpp
src/commands/cmd_rehash.cpp
src/commands/cmd_who.cpp
src/commands/cmd_whois.cpp
src/configreader.cpp
src/helperfuncs.cpp
src/inspircd.cpp
src/mode.cpp
src/modmanager_dynamic.cpp
src/modmanager_static.cpp
src/modules.cpp
src/modules/m_check.cpp
src/modules/m_httpd.cpp
src/modules/m_ircv3.cpp
src/modules/m_permchannels.cpp
src/modules/m_spanningtree/away.cpp
src/modules/m_spanningtree/metadata.cpp
src/modules/m_spanningtree/netburst.cpp
src/modules/m_spanningtree/treesocket1.cpp
src/modules/m_spanningtree/uid.cpp
src/server.cpp
src/snomasks.cpp
src/testsuite.cpp
src/usermanager.cpp
src/users.cpp
src/xline.cpp

index 8ef646a08eee3e922469a70448979541f95aafc3..52e41a1fc49f1a47332045c04a51a96474a9fc38 100644 (file)
@@ -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)->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)
index e9e2a30209df6c69e3cbcd56b0735e84c756e566..d82ad6c233b4345d838d61b41113df96c72c503d 100644 (file)
@@ -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())
index 457934d2b1a6a480af48bf6be98160ba2688c1be..51358519bf3f9983cb2d5d66f158e2bc8d065fe3 100644 (file)
@@ -100,7 +100,7 @@ bool CommandParser::LoopCall(User* user, Command* handler, const std::vector<std
                                // Run the OnPostCommand hook with the last parameter (original line) being empty
                                // to indicate that the command had more targets in its original form.
                                item.clear();
-                               FOREACH_MOD(I_OnPostCommand, OnPostCommand(handler, new_parameters, localuser, result, item));
+                               FOREACH_MOD(OnPostCommand, (handler, new_parameters, localuser, result, item));
                        }
                }
        }
@@ -316,7 +316,7 @@ void CommandParser::ProcessCommand(LocalUser *user, std::string &cmd)
                 */
                CmdResult result = handler->Handle(command_p, user);
 
-               FOREACH_MOD(I_OnPostCommand, OnPostCommand(handler, command_p, user, result, cmd));
+               FOREACH_MOD(OnPostCommand, (handler, command_p, user, result, cmd));
        }
 }
 
index 6e5f2a90996ee45527ae45826e38b9f962a965dd..b3f146c307d79f5ec3da251ab8e45b686bc823d6 100644 (file)
@@ -100,7 +100,7 @@ CmdResult CommandInfo::Handle (const std::vector<std::string>& 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;
 }
index 355bde9e6ed0bbef997362945f4ea7842871c9c7..2ed05c550033c8344cd430c4ad408a7df8f2ebee 100644 (file)
@@ -143,7 +143,7 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& 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))
        {
index 5519be2fa14d1a455cc39fb416b9151b7deaf9d4..ed98c771f64f967fbede63e113faef7cacc39fff 100644 (file)
@@ -84,12 +84,12 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& 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<std::string>& 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<std::string>& 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<std::string>& 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<std::string>& 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
        {
index 923bfe1299092edce3768eb964318d0eaccfb21d..3dc45403609571821bd070dadd9f7965f74c1f37 100644 (file)
@@ -45,7 +45,7 @@ CmdResult CommandRehash::Handle (const std::vector<std::string>& 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<std::string>& 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<std::string>& 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);
index 3023939276502eb8316f56b0df68aefc3ea3de5c..5e0e55b66865abfb0a9c31efa5164e18e316c129 100644 (file)
@@ -229,7 +229,7 @@ void CommandWho::SendWhoLine(User* user, const std::vector<std::string>& 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);
index 116e4313555ffc3b16d03648e102a3b45ceb4b13..f75bd13fe9de26ffc81f0beaafb4c875088c7672 100644 (file)
@@ -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
index b8c54bef9a5ba5ae41696bafcdf3da71b94ea827..d2291556cab222c5fb3eb6c20918307ea25a33fa 100644 (file)
@@ -829,7 +829,7 @@ void ConfigReaderThread::Finish()
                static_cast<ListModeBase*>(*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();
index f70e04d958f087ec57e853d6da322bb227ae9064..2626da6bbd6132518866946809e73fd181503909 100644 (file)
@@ -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())
        {
index 48746cb527498b338de692eaf4abb672f9f71340..78659089c1adf3c10730adf641b681628bcbc91c 100644 (file)
@@ -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();
                        }
                }
index 8eb1020a84315ae69ea9146a0ae733aae0cb9249..3206e5638ca8efeac57a07b0d1ac0d9da55b40d2 100644 (file)
@@ -475,7 +475,7 @@ void ModeParser::Process(const std::vector<std::string>& 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)
        {
index b9c046a8e78e67959669147072881fc39a455a42..a4a3ddb0bb7a16a8be0a9b3a5bc0bd3b0da9cf9d 100644 (file)
@@ -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
index 44c36919bbb606dd16f031fd9a97a237d2af19ba..40123674bcdc7e93862c61d2b2550cf4f45b627f 100644 (file)
@@ -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
index ca312c4a5ec44d4500f23268f1c1fedeaf74d100..26e91f87694f1f383bda1699a080563bb004c785 100644 (file)
@@ -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<std::string, Module*>::iterator modfind = Modules.find(mod->ModuleSourceFile);
 
index 044af04ea644707ca2fee00239c6a6116222f4d9..25835297904c74973e60c59a3aca71387e2f2cdc 100644 (file)
@@ -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
index a04abd5e65b353272eb11607d652812a814401fd..bb5d5c0b0867111c8d69db22a27f0034e5773a77 100644 (file)
@@ -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);
        }
index 7e8a1a8ffaa8f7ec0f4d729fdb98e2e7704d9b9e..643e6a7b391ec0144269948eeb9319b1d55a10d2 100644 (file)
@@ -36,7 +36,7 @@ class ModuleIRCv3 : public Module
                UserChanList chans(user->chans);
 
                std::map<User*, bool> 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<User*, bool>::const_iterator i = exceptions.begin(); i != exceptions.end(); ++i)
index 704745f572539f5838ccba4f6ae60459af1e2162..36dff7a40141d8cbfa028ca2981270ff98d66ac2 100644 (file)
@@ -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);
                        }
index f2cabadd536d2dab52baa2203b0ae892e818d51b..ae60633bf50b351c12420f35dd27d98739f9ef2a 100644 (file)
@@ -30,7 +30,7 @@ bool TreeSocket::Away(const std::string &prefix, parameterlist &params)
                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 &params)
        }
        else
        {
-               FOREACH_MOD(I_OnSetAway, OnSetAway(u, ""));
+               FOREACH_MOD(OnSetAway, (u, ""));
                u->awaymsg.clear();
        }
        Utils->DoOneToAllButSender(prefix,"AWAY",params,u->server);
index 9709ca54cb1752ae7cac9ef246d4a03890c019a7..8ce41d87f1f5012ac12660bf42d091c5ea89ffe3 100644 (file)
@@ -26,7 +26,7 @@ CmdResult CommandMetadata::Handle(const std::vector<std::string>& 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<std::string>& 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<std::string>& 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));
                }
        }
 
index aefb9de01c1e524d0e3768e7e2c777b75ab51099..d86115cce40da25cffc47e455c00084da03cb52e 100644 (file)
@@ -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));
                }
        }
 }
index 69dfa3ce3709f70bde3b8ce34e8a0ab93b57b70a..1c72f3ad78a5c6a8380e4b84faa6e30394658aa5 100644 (file)
@@ -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);
index 4204737cac5d187d3134b945a64b86d82313638b..dd4591a9ba71185f8473e662767a08e90fdac3af 100644 (file)
@@ -148,7 +148,7 @@ CmdResult CommandUID::Handle(const parameterlist &params, 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;
 }
index 580ee5310c0616fd9548c872d5387e3aa6d74925..efefa0d37a4b713951057708e8ffc7844db63124 100644 (file)
@@ -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<std::string, std::string>::iterator extban = tokens.find("EXTBAN");
index fa8e5ab600a26f89ee4fe2dbc32030c46efc72a4..d7cb64f26d45c5f46817049a0070ecc0b8cfa9df 100644 (file)
@@ -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);
        }
 
index efd04cc3f4ad8160911cd9d677b1be25e6df7e56..b27f6e18c991d7e685a6ba202230f525d6acd669 100644 (file)
@@ -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: ";
index 15e59c8000bd06d056015251acbef645723cad35..605bc1f698657e032d15cf979ebbefc45bc44d83 100644 (file)
@@ -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();
        }
 
index fe593a13915816c41fb7c91a69bf22f6dae441c2..0cd92faefe7bedb4b69df08a76243897cc301dcb 100644 (file)
@@ -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<User*,bool>::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<User*,bool> exceptions;
 
-       FOREACH_MOD(I_OnBuildNeighborList,OnBuildNeighborList(this, include_c, exceptions));
+       FOREACH_MOD(OnBuildNeighborList, (this, include_c, exceptions));
 
        for (std::map<User*,bool>::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<User*,bool> exceptions;
 
-       FOREACH_MOD(I_OnBuildNeighborList,OnBuildNeighborList(this, include_c, exceptions));
+       FOREACH_MOD(OnBuildNeighborList, (this, include_c, exceptions));
 
        for (std::map<User*,bool>::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";
 
index 4bb9551ecc6d8c1006f6b70459ec936004c78047..44ae1e98ecbf980ba12e415bdf77bfdbe4705591 100644 (file)
@@ -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();