From 7892c8a0313c50d8138942ff3b112691caf05a2f Mon Sep 17 00:00:00 2001 From: danieldg Date: Sun, 13 Sep 2009 20:31:23 +0000 Subject: Replace OnAccessCheck with OnPreMode to remove a number of redundant checks git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11700 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modes/cmode_v.cpp | 77 +-------------------------------------------------- 1 file changed, 1 insertion(+), 76 deletions(-) (limited to 'src/modes/cmode_v.cpp') diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp index 031cefb7f..752dd509b 100644 --- a/src/modes/cmode_v.cpp +++ b/src/modes/cmode_v.cpp @@ -72,80 +72,5 @@ void ModeChannelVoice::RemoveMode(User*, irc::modestacker* stack) ModeAction ModeChannelVoice::OnModeChange(User* source, User*, Channel* channel, std::string ¶meter, bool adding) { - int status = channel->GetPrefixValue(source); - - /* Call the correct method depending on wether we're adding or removing the mode */ - if (adding) - { - parameter = this->AddVoice(source, parameter.c_str(), channel, status); - } - else - { - parameter = this->DelVoice(source, parameter.c_str(), channel, status); - } - /* If the method above 'ate' the parameter by reducing it to an empty string, then - * it won't matter wether we return ALLOW or DENY here, as an empty string overrides - * the return value and is always MODEACTION_DENY if the mode is supposed to have - * a parameter. - */ - if (parameter.length()) - return MODEACTION_ALLOW; - else - return MODEACTION_DENY; -} - -std::string ModeChannelVoice::AddVoice(User *user,const char* dest,Channel *chan,int status) -{ - User *d = ServerInstance->Modes->SanityChecks(user,dest,chan,status); - - if (d) - { - if (IS_LOCAL(user)) - { - ModResult MOD_RESULT; - FIRST_MOD_RESULT(ServerInstance, OnAccessCheck, MOD_RESULT, (user,d,chan,AC_VOICE)); - - if (MOD_RESULT == MOD_RES_DENY) - return ""; - if (MOD_RESULT == MOD_RES_PASSTHRU) - { - if ((status < HALFOP_VALUE) && (!ServerInstance->ULine(user->server))) - { - user->WriteServ("482 %s %s :You're not a channel (half)operator",user->nick.c_str(), chan->name.c_str()); - return ""; - } - } - } - - return d->nick; - } - return ""; -} - -std::string ModeChannelVoice::DelVoice(User *user,const char *dest,Channel *chan,int status) -{ - User *d = ServerInstance->Modes->SanityChecks(user,dest,chan,status); - - if (d) - { - if (IS_LOCAL(user)) - { - ModResult MOD_RESULT; - FIRST_MOD_RESULT(ServerInstance, OnAccessCheck, MOD_RESULT, (user,d,chan,AC_DEVOICE)); - - if (MOD_RESULT == MOD_RES_DENY) - return ""; - if (MOD_RESULT == MOD_RES_PASSTHRU) - { - if ((status < HALFOP_VALUE) && (!ServerInstance->ULine(user->server))) - { - user->WriteServ("482 %s %s :You are not a channel (half)operator",user->nick.c_str(), chan->name.c_str()); - return ""; - } - } - } - - return d->nick; - } - return ""; + return MODEACTION_ALLOW; } -- cgit v1.2.3