summaryrefslogtreecommitdiff
path: root/src/modes/cmode_v.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-13 20:31:23 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-13 20:31:23 +0000
commit7892c8a0313c50d8138942ff3b112691caf05a2f (patch)
tree9c0c4a20584c0dca6adbeddec538ff871546dabe /src/modes/cmode_v.cpp
parentb4be0c94ab5fb7e5a7a799a195c78de072a5e315 (diff)
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
Diffstat (limited to 'src/modes/cmode_v.cpp')
-rw-r--r--src/modes/cmode_v.cpp77
1 files changed, 1 insertions, 76 deletions
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 &parameter, 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;
}