]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modes/cmode_k.cpp
Fix modules/extra symlinks when calculating dependencies
[user/henk/code/inspircd.git] / src / modes / cmode_k.cpp
index de420cae2eb8a08db0bad66bfe326eb4274a2fbf..4105660d11d5183a6090d334a06fe5d0e1f6f61a 100644 (file)
@@ -3,7 +3,7 @@
  *       +------------------------------------+
  *
  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
@@ -17,7 +17,7 @@
 #include "users.h"
 #include "modes/cmode_k.h"
 
-ModeChannelKey::ModeChannelKey(InspIRCd* Instance) : ModeHandler(Instance, 'k', 1, 1, false, MODETYPE_CHANNEL, false)
+ModeChannelKey::ModeChannelKey() : ModeHandler(NULL, 'k', PARAM_ALWAYS, MODETYPE_CHANNEL)
 {
 }
 
@@ -61,13 +61,7 @@ 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)
+ModeAction ModeChannelKey::OnModeChange(User* source, User*, Channel* channel, std::string &parameter, bool adding)
 {
        bool exists = channel->IsModeSet('k');
        if (IS_LOCAL(source))
@@ -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;
 }