X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodes%2Fcmode_h.cpp;h=d5472c154650f035dc6239e2c70f6dad9a6a2cf8;hb=7aa5e059a8f66d91bd8b69c58c657ceb70b4baff;hp=480d69f0a5002b8b7788c7bc5efb24db18ad61eb;hpb=91df762e93212958db487d8517addba1a63a4ddd;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp index 480d69f0a..d5472c154 100644 --- a/src/modes/cmode_h.cpp +++ b/src/modes/cmode_h.cpp @@ -19,8 +19,12 @@ #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 ¶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->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 ""; -} -