]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/channels.cpp
Allow for skipping clone checking before DNS is complete.
[user/henk/code/inspircd.git] / src / channels.cpp
index 0d43bc802e129b89151ab5935b10f62aee28682f..8c59e68939d68a1c20f8727bf86b8e5959f78515 100644 (file)
@@ -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)