diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-09-04 13:04:01 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-09-04 13:04:01 +0200 |
commit | f535b1ef72eb4c298ce999bac791acb48665dc66 (patch) | |
tree | 2ef56fc070fb85ed6d2c255cea69fcefc4c132bd | |
parent | 5f031349833d18d9fe5495b848c2d3fb7fd7f8f0 (diff) |
m_namedmodes Build and process a Modes::ChangeList when handling PROP
-rw-r--r-- | src/modules/m_namedmodes.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
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<std::string> ¶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<std::string> 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; } }; |