modes.reset();
}
-void Channel::SetMode(char mode,bool mode_on)
-{
- modes[mode-65] = mode_on;
-}
-
void Channel::SetMode(ModeHandler* mh, bool on)
{
modes[mh->GetModeChar() - 65] = on;
void Channel::SetModeParam(char mode, const std::string& parameter)
{
- 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())
{
+ custom_mode_params.erase(mode);
modes[mode-65] = false;
}
else
return "";
}
-int Channel::SetTopic(User *u, std::string &ntopic, bool forceset)
+void Channel::SetTopic(User* u, const std::string& ntopic)
{
- 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;
- }
- }
- }
-
this->topic.assign(ntopic, 0, ServerInstance->Config->Limits.MaxTopic);
this->setby.assign(ServerInstance->Config->FullHostInTopic ? u->GetFullHost() : u->nick, 0, 128);
this->WriteChannel(u, "TOPIC %s :%s", this->name.c_str(), this->topic.c_str());
this->topicset = ServerInstance->Time();
FOREACH_MOD(I_OnPostTopicChange,OnPostTopicChange(u, this, this->topic));
-
- return CMD_SUCCESS;
}
Membership* Channel::AddUser(User* user)
void Channel::ForceJoin(User* user, const std::string* privs, bool bursting, bool created_by_local)
{
- Membership* memb = this->AddUser(user);
- if (!memb)
- return; // Already on the channel
-
if (IS_SERVER(user))
{
ServerInstance->Logs->Log("CHANNELS", LOG_DEBUG, "Attempted to join server user " + user->uuid + " to channel " + this->name);
return;
}
+ Membership* memb = this->AddUser(user);
+ if (!memb)
+ return; // Already on the channel
+
user->chans.insert(this);
if (privs)