]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modes/cmode_k.cpp
Remove useless vector copy
[user/henk/code/inspircd.git] / src / modes / cmode_k.cpp
index f2afb9ac025e10b56620615b89ac2b5dc33a1a8c..b270966da42565b8e0558000753c39640998bbc7 100644 (file)
@@ -61,12 +61,6 @@ void ModeChannelKey::RemoveMode(User*, irc::modestacker* stack)
 {
 }
 
-bool ModeChannelKey::CheckTimeStamp(time_t, time_t, const std::string &their_param, const std::string &our_param, Channel*)
-{
-       /* When TS is equal, the alphabetically later channel key wins */
-       return (their_param < our_param);
-}
-
 ModeAction ModeChannelKey::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding, bool servermode)
 {
        bool exists = channel->IsModeSet('k');
@@ -94,20 +88,16 @@ ModeAction ModeChannelKey::OnModeChange(User* source, User*, Channel* channel, s
        if (parameter.rfind(' ') != std::string::npos)
                return MODEACTION_DENY;
 
-       /* must first unset if we are changing the key, otherwise it will be ignored */
-       if (exists && adding)
-               channel->SetMode('k', false);
-
-       /* must run setmode always, to process the change */
-       channel->SetMode('k', adding);
-
        if (adding)
        {
                std::string ckey;
                ckey.assign(parameter, 0, 32);
                parameter = ckey;
-               /* running this does not run setmode, despite the third parameter */
-               channel->SetModeParam('k', parameter.c_str(), true);
+               channel->SetModeParam('k', parameter);
+       }
+       else
+       {
+               channel->SetModeParam('k', "");
        }
        return MODEACTION_ALLOW;
 }