X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodes%2Fcmode_k.cpp;h=4f95f3ad1baf5de5836d218b8d5686563c3d1e0b;hb=812dcf79f6ccea65a616f4aecb5701e1846e8aea;hp=e509447f3c318bdaf0f45840341ad5668647366a;hpb=a1f073f66f4b985bf776b9be2015136209c0c311;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp index e509447f3..4f95f3ad1 100644 --- a/src/modes/cmode_k.cpp +++ b/src/modes/cmode_k.cpp @@ -4,7 +4,7 @@ #include "users.h" #include "modes/cmode_k.h" -ModeChannelKey::ModeChannelKey() : ModeHandler('k', 1, 1, false, MODETYPE_CHANNEL, false) +ModeChannelKey::ModeChannelKey(InspIRCd* Instance) : ModeHandler(Instance, 'k', 1, 1, false, MODETYPE_CHANNEL, false) { } @@ -33,15 +33,20 @@ ModeAction ModeChannelKey::OnModeChange(userrec* source, userrec* dest, chanrec* if (((channel->modes[CM_KEY]) && (strcasecmp(parameter.c_str(),channel->key))) && (IS_LOCAL(source))) { /* Key is currently set and the correct key wasnt given */ - log(DEBUG,"Key Cond 2"); + ServerInstance->Log(DEBUG,"Key Cond 2"); return MODEACTION_DENY; } 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)))) { @@ -50,12 +55,12 @@ ModeAction ModeChannelKey::OnModeChange(userrec* source, userrec* dest, chanrec* channel->modes[CM_KEY] = adding; return MODEACTION_ALLOW; } - log(DEBUG,"Key Cond three"); + ServerInstance->Log(DEBUG,"Key Cond three"); return MODEACTION_DENY; } else { - log(DEBUG,"Key Condition one"); + ServerInstance->Log(DEBUG,"Key Condition one"); return MODEACTION_DENY; } }