]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modes/cmode_h.cpp
Remove include/inspircd_se_config.h and socketengine-specific headers
[user/henk/code/inspircd.git] / src / modes / cmode_h.cpp
index 480d69f0a5002b8b7788c7bc5efb24db18ad61eb..d5472c154650f035dc6239e2c70f6dad9a6a2cf8 100644 (file)
 #include "modules.h"
 #include "modes/cmode_h.h"
 
-ModeChannelHalfOp::ModeChannelHalfOp(InspIRCd* Instance) : ModeHandler(Instance, NULL, 'h', 1, 1, true, MODETYPE_CHANNEL, false, '%', '@', TR_NICK)
+ModeChannelHalfOp::ModeChannelHalfOp() : ModeHandler(NULL, 'h', PARAM_ALWAYS, MODETYPE_CHANNEL)
 {
+       list = true;
+       prefix = '%';
+       levelrequired = OP_VALUE;
+       m_paramtype = TR_NICK;
 }
 
 unsigned int ModeChannelHalfOp::GetPrefixRank()
@@ -74,81 +78,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 "";
-}
-