- CustomModeList::iterator n = custom_mode_params.find(mode);
- // always erase, even if changing, so that the map gets the new value
- if (n != custom_mode_params.end())
- custom_mode_params.erase(n);
- if (parameter.empty())
- {
- modes[mode-65] = false;
- }
- else
- {
- custom_mode_params[mode] = parameter;
- modes[mode-65] = true;
- }
-}
-
-void Channel::SetModeParam(ModeHandler* mode, const std::string& parameter)
-{
- SetModeParam(mode->GetModeChar(), parameter);
-}
-
-std::string Channel::GetModeParameter(char mode)
-{
- CustomModeList::iterator n = custom_mode_params.find(mode);
- if (n != custom_mode_params.end())
- return n->second;
- return "";
-}
-
-std::string Channel::GetModeParameter(ModeHandler* mode)
-{
- CustomModeList::iterator n = custom_mode_params.find(mode->GetModeChar());
- if (n != custom_mode_params.end())
- return n->second;
- return "";
-}
-
-int Channel::SetTopic(User *u, std::string &ntopic, bool forceset)
-{
- if (IS_LOCAL(u) && !forceset)
- {
- ModResult res;
- FIRST_MOD_RESULT(OnPreTopicChange, res, (u,this,ntopic));
-
- if (res == MOD_RES_DENY)
- return CMD_FAILURE;
- if (res != MOD_RES_ALLOW)
- {
- if (!this->HasUser(u))
- {
- u->WriteNumeric(442, "%s %s :You're not on that channel!",u->nick.c_str(), this->name.c_str());
- return CMD_FAILURE;
- }
- if (IsModeSet('t') && !ServerInstance->OnCheckExemption(u,this,"topiclock").check(GetPrefixValue(u) >= HALFOP_VALUE))
- {
- u->WriteNumeric(482, "%s %s :You do not have access to change the topic on this channel", u->nick.c_str(), this->name.c_str());
- return CMD_FAILURE;
- }
- }
- }
-