]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modes/cmode_k.cpp
auto-set +s when +n is set (as +n requires +s) - allow +n to be 'set twice' allowing...
[user/henk/code/inspircd.git] / src / modes / cmode_k.cpp
index 6e5ba0269f9723fc1c2e5f384898da2da27a7bf3..4f95f3ad1baf5de5836d218b8d5686563c3d1e0b 100644 (file)
@@ -39,9 +39,14 @@ ModeAction ModeChannelKey::OnModeChange(userrec* source, userrec* dest, chanrec*
                else if ((!channel->modes[CM_KEY]) || ((adding) && (!IS_LOCAL(source))))
                {
                        /* Key isnt currently set */
-                       strlcpy(channel->key,parameter.c_str(),32);
-                       channel->modes[CM_KEY] = adding;
-                       return MODEACTION_ALLOW;
+                       if ((parameter.length()) && (parameter.rfind(' ') == std::string::npos))
+                       {
+                               strlcpy(channel->key,parameter.c_str(),32);
+                               channel->modes[CM_KEY] = adding;
+                               return MODEACTION_ALLOW;
+                       }
+                       else
+                               return MODEACTION_DENY;
                }
                else if (((channel->modes[CM_KEY]) && (!strcasecmp(parameter.c_str(),channel->key))) || ((!adding) && (!IS_LOCAL(source))))
                {