X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodes%2Fcmode_k.cpp;h=4d4453d4497b79161dec6aeaa04dce9269eb9c62;hb=87dd84a97265843cfe19f20c207c1c72f38a4f2d;hp=0ab35b954bcd2fb4ebc34159048fd61422b0fbc5;hpb=ffbd1eebf0b82bf40482879f410f58874030a695;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp index 0ab35b954..4d4453d44 100644 --- a/src/modes/cmode_k.cpp +++ b/src/modes/cmode_k.cpp @@ -63,31 +63,31 @@ bool ModeChannelKey::CheckTimeStamp(time_t, time_t, const std::string &their_par ModeAction ModeChannelKey::OnModeChange(User* source, User*, Channel* channel, std::string ¶meter, bool adding, bool servermode) { - if ((channel->modes[CM_KEY] != adding) || (!IS_LOCAL(source))) + if ((channel->IsModeSet('k') != adding) || (!IS_LOCAL(source))) { - if (((channel->modes[CM_KEY]) && (strcasecmp(parameter.c_str(),channel->key))) && (IS_LOCAL(source))) + if (((channel->IsModeSet('k')) && (parameter != channel->key)) && (IS_LOCAL(source))) { /* Key is currently set and the correct key wasnt given */ return MODEACTION_DENY; } - else if ((!channel->modes[CM_KEY]) || ((adding) && (!IS_LOCAL(source)))) + else if ((!channel->IsModeSet('k')) || ((adding) && (!IS_LOCAL(source)))) { /* Key isnt currently set */ if ((parameter.length()) && (parameter.rfind(' ') == std::string::npos)) { - strlcpy(channel->key,parameter.c_str(),32); - channel->modes[CM_KEY] = adding; + channel->key.assign(parameter, 0, 32); + channel->SetMode('k', adding); parameter = channel->key; return MODEACTION_ALLOW; } else return MODEACTION_DENY; } - else if (((channel->modes[CM_KEY]) && (!strcasecmp(parameter.c_str(),channel->key))) || ((!adding) && (!IS_LOCAL(source)))) + else if (((channel->IsModeSet('k')) && (parameter == channel->key)) || ((!adding) && (!IS_LOCAL(source)))) { /* Key is currently set, and correct key was given */ - *channel->key = 0; - channel->modes[CM_KEY] = adding; + channel->key.clear(); + channel->SetMode('k', adding); return MODEACTION_ALLOW; } return MODEACTION_DENY;