X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_namedmodes.cpp;h=19dff1a8b6baa2e588e4e21b376f55e19e5907ad;hb=7cb79020b7a9d7431d3038953c8e05ec0f2158c7;hp=4004db00e93d488301a58b30088ab897a4a4c2ad;hpb=5f031349833d18d9fe5495b848c2d3fb7fd7f8f0;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_namedmodes.cpp b/src/modules/m_namedmodes.cpp index 4004db00e..19dff1a8b 100644 --- a/src/modules/m_namedmodes.cpp +++ b/src/modules/m_namedmodes.cpp @@ -47,17 +47,20 @@ class CommandProp : public Command CmdResult Handle(const std::vector ¶meters, User *src) { + Channel* const chan = ServerInstance->FindChan(parameters[0]); + if (!chan) + { + src->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str()); + return CMD_FAILURE; + } + if (parameters.size() == 1) { - Channel* chan = ServerInstance->FindChan(parameters[0]); - if (chan) - DisplayList(src, chan); + DisplayList(src, chan); return CMD_SUCCESS; } unsigned int i = 1; - std::vector modes; - modes.push_back(parameters[0]); - modes.push_back(""); + Modes::ChangeList modes; while (i < parameters.size()) { std::string prop = parameters[i++]; @@ -68,16 +71,16 @@ class CommandProp : public Command ModeHandler* mh = ServerInstance->Modes->FindMode(prop, MODETYPE_CHANNEL); if (mh) { - modes[1].push_back(plus ? '+' : '-'); - modes[1].push_back(mh->GetModeChar()); if (mh->GetNumParams(plus)) { if (i != parameters.size()) - modes.push_back(parameters[i++]); + modes.push(mh, plus, parameters[i++]); } + else + modes.push(mh, plus); } } - ServerInstance->Modes->Process(modes, src); + ServerInstance->Modes->ProcessSingle(src, chan, NULL, modes, ModeParser::MODE_CHECKACCESS); return CMD_SUCCESS; } };