summaryrefslogtreecommitdiff
path: root/src/modes/cmode_h.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_h.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_h.cpp')
-rw-r--r--src/modes/cmode_h.cpp78
1 files changed, 1 insertions, 77 deletions
diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp
index 480d69f0a..a61df4ba0 100644
--- a/src/modes/cmode_h.cpp
+++ b/src/modes/cmode_h.cpp
@@ -74,81 +74,5 @@ void ModeChannelHalfOp::RemoveMode(User*, irc::modestacker* stack)
ModeAction ModeChannelHalfOp::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->AddHalfOp(source, parameter.c_str(), channel, status);
- }
- else
- {
- parameter = this->DelHalfOp(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 ModeChannelHalfOp::AddHalfOp(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_HALFOP));
-
- if (MOD_RESULT == MOD_RES_DENY)
- return "";
- if (MOD_RESULT == MOD_RES_PASSTHRU)
- {
- if ((status < OP_VALUE) && (!ServerInstance->ULine(user->server)))
- {
- user->WriteServ("482 %s %s :You're not a channel operator",user->nick.c_str(), chan->name.c_str());
- return "";
- }
- }
- }
-
- return d->nick;
- }
- return "";
+ return MODEACTION_ALLOW;
}
-
-std::string ModeChannelHalfOp::DelHalfOp(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_DEHALFOP));
-
- if (MOD_RESULT == MOD_RES_DENY)
- return "";
- if (MOD_RESULT == MOD_RES_PASSTHRU)
- {
- if ((user != d) && ((status < OP_VALUE) && (!ServerInstance->ULine(user->server))))
- {
- user->WriteServ("482 %s %s :You are not a channel operator",user->nick.c_str(), chan->name.c_str());
- return "";
- }
- }
- }
-
- return d->nick;
- }
- return "";
-}
-