From 31f1e7ad092f8bf16ee653cc105eea4a769650ca Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 19 May 2008 21:16:42 +0000 Subject: Convert channel::name to std::string, this was a beastie! git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9770 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modes/cmode_k.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/modes/cmode_k.cpp') 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; -- cgit v1.2.3