From e27f3380733a4412007a3f023069615d1218ab96 Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 2 Sep 2009 00:44:24 +0000 Subject: Replace FOREACH_RESULT_MAP with a more readable and flexible do_each_hook/while_each_hook macro pair git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11598 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/channels.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/channels.cpp b/src/channels.cpp index 6e0f4c686..532953db3 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -475,9 +475,11 @@ Channel* Channel::ForceChan(InspIRCd* Instance, Channel* Ptr, User* user, const bool Channel::IsBanned(User* user) { int result = 0; - FOREACH_RESULT_MAP(I_OnCheckBan, OnCheckBan(user, this), - result = banmatch_reduce(result, MOD_RESULT); - ); + DO_EACH_HOOK(ServerInstance, OnCheckBan, int modresult, (user, this)) + { + result = banmatch_reduce(result, modresult); + } + WHILE_EACH_HOOK(ServerInstance, OnCheckBan); if (result) return (result < 0); @@ -499,9 +501,11 @@ bool Channel::IsBanned(User* user) int Channel::GetExtBanStatus(const std::string &str, char type) { int result = 0; - FOREACH_RESULT_MAP(I_OnCheckStringExtBan, OnCheckStringExtBan(str, this, type), - result = banmatch_reduce(result, MOD_RESULT); - ); + DO_EACH_HOOK(ServerInstance, OnCheckStringExtBan, int modresult, (str, this, type)) + { + result = banmatch_reduce(result, modresult); + } + WHILE_EACH_HOOK(ServerInstance, OnCheckStringExtBan); if (result) return result; @@ -525,9 +529,11 @@ int Channel::GetExtBanStatus(const std::string &str, char type) int Channel::GetExtBanStatus(User *user, char type) { int result = 0; - FOREACH_RESULT_MAP(I_OnCheckExtBan, OnCheckExtBan(user, this, type), - result = banmatch_reduce(result, MOD_RESULT); - ); + DO_EACH_HOOK(ServerInstance, OnCheckExtBan, int modresult, (user, this, type)) + { + result = banmatch_reduce(result, modresult); + } + WHILE_EACH_HOOK(ServerInstance, OnCheckExtBan); if (result) return result; -- cgit v1.2.3