From f2cdf27dd9c45f91f4184b81ea3b9be7c5d88173 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Thu, 11 Apr 2013 23:47:45 +0200 Subject: Replace hardcoded mode letters passed to IsModeSet() and GetModeParameter() with ModeHandlers, part 1 --- src/modes/cmode_k.cpp | 6 +++--- src/modes/umode_s.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/modes') diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp index f07d47172..e56b26ff1 100644 --- a/src/modes/cmode_k.cpp +++ b/src/modes/cmode_k.cpp @@ -32,18 +32,18 @@ ModeChannelKey::ModeChannelKey() : ModeHandler(NULL, "key", 'k', PARAM_ALWAYS, M ModeAction ModeChannelKey::OnModeChange(User* source, User*, Channel* channel, std::string ¶meter, bool adding) { - bool exists = channel->IsModeSet('k'); + bool exists = channel->IsModeSet(this); if (IS_LOCAL(source)) { if (exists == adding) return MODEACTION_DENY; - if (exists && (parameter != channel->GetModeParameter('k'))) + if (exists && (parameter != channel->GetModeParameter(this))) { /* Key is currently set and the correct key wasnt given */ return MODEACTION_DENY; } } else { - if (exists && adding && parameter == channel->GetModeParameter('k')) + if (exists && adding && parameter == channel->GetModeParameter(this)) { /* no-op, don't show */ return MODEACTION_DENY; diff --git a/src/modes/umode_s.cpp b/src/modes/umode_s.cpp index 9473d760e..f5631c695 100644 --- a/src/modes/umode_s.cpp +++ b/src/modes/umode_s.cpp @@ -36,18 +36,18 @@ ModeAction ModeUserServerNoticeMask::OnModeChange(User* source, User* dest, Chan if (adding) { /* Fix for bug #310 reported by Smartys */ - if (!dest->modes[UM_SNOMASK]) + if (!dest->IsModeSet(this)) dest->snomasks.reset(); - dest->modes[UM_SNOMASK] = true; + dest->SetMode(this, true); parameter = dest->ProcessNoticeMasks(parameter.c_str()); return MODEACTION_ALLOW; } else { - if (dest->modes[UM_SNOMASK] != false) + if (dest->IsModeSet(this)) { - dest->modes[UM_SNOMASK] = false; + dest->SetMode(this, false); return MODEACTION_ALLOW; } } -- cgit v1.2.3