X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fchannels.cpp;h=8c59e68939d68a1c20f8727bf86b8e5959f78515;hb=f2cdf27dd9c45f91f4184b81ea3b9be7c5d88173;hp=0d43bc802e129b89151ab5935b10f62aee28682f;hpb=8a06d54076551387f83a29360478ee6605e241b6;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/channels.cpp b/src/channels.cpp index 0d43bc802..8c59e6893 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -44,11 +44,6 @@ Channel::Channel(const std::string &cname, time_t ts) 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; @@ -56,12 +51,9 @@ void Channel::SetMode(ModeHandler* mh, bool 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 @@ -92,38 +84,14 @@ std::string Channel::GetModeParameter(ModeHandler* mode) 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) @@ -360,16 +328,16 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co 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)