X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodes%2Fcmode_v.cpp;h=f744623a609db02e690313b1aff2b681c9386277;hb=075bb82c3ebdf4e77f14134ca8343631dd4cfbcd;hp=031cefb7fcdacd315bbc298d336fd08939d85b00;hpb=91df762e93212958db487d8517addba1a63a4ddd;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modes/cmode_v.cpp b/src/modes/cmode_v.cpp index 031cefb7f..f744623a6 100644 --- a/src/modes/cmode_v.cpp +++ b/src/modes/cmode_v.cpp @@ -20,8 +20,12 @@ #include "modules.h" #include "modes/cmode_v.h" -ModeChannelVoice::ModeChannelVoice(InspIRCd* Instance) : ModeHandler(Instance, NULL, 'v', 1, 1, true, MODETYPE_CHANNEL, false, '+', '%', TR_NICK) +ModeChannelVoice::ModeChannelVoice() : ModeHandler(NULL, 'v', PARAM_ALWAYS, MODETYPE_CHANNEL) { + list = true; + prefix = '+'; + levelrequired = HALFOP_VALUE; + m_paramtype = TR_NICK; } unsigned int ModeChannelVoice::GetPrefixRank() @@ -72,80 +76,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; }